/* ========================================================
   FlaStudio 制作管理システム - Stylesheet (Material Design 3)
   Font: Zen Maru Gothic
   ======================================================== */

:root {
  /* Google Material Design 3 色定義 */
  --md-sys-color-primary: #3b5ba9;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #dbe1ff;
  --md-sys-color-on-primary-container: #00174b;

  --md-sys-color-secondary: #585e71;
  --md-sys-color-secondary-container: #dce2f9;
  --md-sys-color-on-secondary-container: #151b2c;

  --md-sys-color-tertiary: #715573;
  --md-sys-color-tertiary-container: #fbd7fc;
  --md-sys-color-on-tertiary-container: #29132d;

  --md-sys-color-surface: #fbf8fd;
  --md-sys-color-surface-container: #f0edf2;
  --md-sys-color-surface-container-high: #eae7ec;
  --md-sys-color-on-surface: #1a1b1f;
  --md-sys-color-on-surface-variant: #45464f;
  --md-sys-color-outline: #757680;
  --md-sys-color-outline-variant: #c5c6d0;

  /* 納期ハイライト色 */
  --color-due-highlight: #e11d48;
  --color-due-bg: #ffe4e6;

  /* MTG日ハイライト色 */
  --color-mtg-highlight: #0284c7;
  --color-mtg-bg: #e0f2fe;

  --m3-shape-corner-small: 8px;
  --m3-shape-corner-medium: 12px;
  --m3-shape-corner-large: 16px;
  --m3-shape-corner-full: 9999px;

  --font-family: 'Zen Maru Gothic', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* ========================================================
   共通 M3 コンポーネントスタイル
   ======================================================== */

.m3-button {
  font-family: var(--font-family);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--m3-shape-corner-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
}

.m3-button.filled {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.m3-button.filled:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  filter: brightness(1.05);
}

.m3-button.tonal {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.m3-button.tonal:hover {
  filter: brightness(0.96);
}

.m3-button.outlined {
  background-color: transparent;
  border: 1px solid var(--md-sys-color-outline);
  color: var(--md-sys-color-primary);
}
.m3-button.outlined:hover {
  background-color: rgba(59, 91, 169, 0.08);
}

.m3-button.text {
  background-color: transparent;
  color: var(--md-sys-color-primary);
}
.m3-button.text:hover {
  background-color: rgba(59, 91, 169, 0.08);
}

.m3-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--m3-shape-corner-full);
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.2s;
}
.m3-icon-button:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.m3-card {
  background-color: #ffffff;
  border-radius: var(--m3-shape-corner-large);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* フォーム要素 */
.m3-textfield, .m3-selectfield {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.m3-textfield label, .m3-selectfield label, .field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-textfield input, .m3-selectfield select, .m3-textfield textarea {
  font-family: var(--font-family);
  padding: 10px 14px;
  border-radius: var(--m3-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.m3-textfield input:focus, .m3-selectfield select:focus, .m3-textfield textarea:focus {
  border-color: var(--md-sys-color-primary);
  background-color: #ffffff;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-small);
  padding: 0 12px;
}
.input-wrapper .material-symbols-outlined {
  color: var(--md-sys-color-outline);
  margin-right: 8px;
}
.input-wrapper input {
  border: none;
  background: transparent;
  width: 100%;
  padding: 10px 0;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-row > * {
  flex: 1;
}

.checkbox-row {
  margin-bottom: 16px;
  padding: 8px 12px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--m3-shape-corner-small);
}
.m3-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.m3-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--md-sys-color-primary);
}

/* ========================================================
   認証モーダル
   ======================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.auth-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo-icon {
  font-size: 48px;
  color: var(--md-sys-color-primary);
}
.auth-title {
  font-size: 26px;
  font-weight: 700;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 4px;
}
.auth-actions {
  margin-top: 24px;
}
.auth-actions button {
  width: 100%;
  height: 46px;
  font-size: 15px;
}
.auth-notice {
  font-size: 12px;
  color: var(--md-sys-color-outline);
  text-align: center;
  margin-top: 16px;
}

/* ========================================================
   レイアウト & ナビゲーション
   ======================================================== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.m3-top-app-bar {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  z-index: 10;
}

.bar-left, .bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-icon {
  color: var(--md-sys-color-primary);
  font-size: 26px;
}
.brand-text {
  font-size: 17px;
  font-weight: 700;
  margin-right: 4px;
}

.main-nav-tabs {
  display: flex;
  gap: 4px;
  background-color: var(--md-sys-color-surface-container);
  padding: 4px;
  border-radius: var(--m3-shape-corner-full);
}
.nav-tab-btn {
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--m3-shape-corner-full);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-tab-btn .material-symbols-outlined {
  font-size: 18px;
}
.nav-tab-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
.nav-tab-btn.active {
  background-color: #ffffff;
  color: var(--md-sys-color-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--md-sys-color-surface-container);
  padding: 4px 10px;
  border-radius: var(--m3-shape-corner-medium);
}
.breadcrumb-btn {
  font-family: var(--font-family);
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  cursor: pointer;
}
.breadcrumb-btn:hover {
  text-decoration: underline;
}
.breadcrumb-sep {
  color: var(--md-sys-color-outline);
  font-size: 11px;
}
.breadcrumb-current {
  font-size: 12px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.filter-toggle-btn.active {
  background-color: var(--md-sys-color-tertiary-container);
  border-color: var(--md-sys-color-tertiary);
  color: var(--md-sys-color-on-tertiary-container);
  font-weight: 700;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--md-sys-color-surface-container);
  padding: 4px 12px;
  border-radius: var(--m3-shape-corner-full);
  font-size: 13px;
  font-weight: 500;
}

.main-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  overflow: hidden;
  gap: 14px;
}

.page-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 16px;
  overflow-y: auto;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.view-title {
  font-size: 18px;
  font-weight: 700;
}
.view-subtitle {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}
.section-title {
  font-size: 16px;
  font-weight: 700;
}

/* ========================================================
   全プロジェクト横断マイスケジュール (Home上部)
   ======================================================== */
.my-schedule-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.schedule-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.schedule-icon {
  font-size: 28px;
  color: var(--color-due-highlight);
}
.schedule-summary-badge {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  padding: 4px 12px;
  border-radius: var(--m3-shape-corner-full);
  font-size: 12px;
  font-weight: 700;
}

.my-schedule-card {
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 12px;
}

.schedule-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--m3-shape-corner-medium);
  border-bottom: 1px solid #f0edf2;
  transition: background-color 0.15s;
}
.schedule-task-row:last-child {
  border-bottom: none;
}
.schedule-task-row:hover {
  background-color: var(--md-sys-color-surface-container);
}
.schedule-task-row.is-completed {
  opacity: 0.6;
}

.schedule-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  overflow: hidden;
}
.schedule-project-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.schedule-task-title {
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-task-title:hover {
  color: var(--md-sys-color-primary);
}
.schedule-subtask-tag {
  font-size: 10px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.schedule-mtg-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  background: #e0f2fe;
  color: var(--color-mtg-highlight);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.schedule-mtg-tag .material-symbols-outlined {
  font-size: 12px;
}

.schedule-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.schedule-due-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.schedule-due-tag.due {
  background: #ffe4e6;
  color: #e11d48;
}
.schedule-due-tag.mtg {
  background: #e0f2fe;
  color: #0284c7;
}

/* ========================================================
   ホーム画面 (覚書)
   ======================================================== */
.home-notes-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  align-content: start;
  padding-bottom: 20px;
}
.note-card {
  background: #ffffff;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-medium);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}
.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}
.note-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--m3-shape-corner-full);
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 500;
}
.note-content {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: pre-wrap;
  line-height: 1.6;
}
.note-footer {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  border-top: 1px dashed var(--md-sys-color-outline-variant);
  padding-top: 8px;
}

/* ========================================================
   表示モード切替
   ======================================================== */
.display-mode-switch {
  display: flex;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-full);
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
}
.mode-btn {
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn .material-symbols-outlined {
  font-size: 16px;
}
.mode-btn.active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-weight: 700;
}

/* ========================================================
   ガントチャート & 納期・MTG日色付けハイライト
   ======================================================== */
.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.left-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back-btn {
  height: 36px;
  font-size: 12px;
}
.add-track-btn {
  height: 32px;
  font-size: 12px;
}

.category-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-chip {
  font-family: var(--font-family);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--m3-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: #ffffff;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-chip .material-symbols-outlined {
  font-size: 16px;
}
.filter-chip:hover {
  background-color: var(--md-sys-color-surface-container);
}
.filter-chip.active {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: var(--md-sys-color-primary);
  font-weight: 700;
}

.gantt-section {
  flex: 1;
  display: flex;
  min-height: 0;
}
.gantt-card, .portfolio-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gantt-header-row {
  display: flex;
  height: 48px;
  background-color: var(--md-sys-color-surface-container-high);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  font-size: 13px;
  font-weight: 700;
}

.gantt-sidebar-header {
  width: 380px;
  min-width: 380px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--md-sys-color-outline-variant);
}

.gantt-timeline-header {
  flex: 1;
  display: flex;
  overflow-x: hidden;
}

/* タイムライン日付セル */
.timeline-day-cell {
  min-width: 44px;
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s;
}
.timeline-day-cell.today {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 700;
}

/* 納期当日のみのハイライト */
.timeline-day-cell.is-due-date {
  background-color: var(--color-due-bg) !important;
  color: var(--color-due-highlight) !important;
  font-weight: 700;
  border-bottom: 3px solid var(--color-due-highlight);
}
.timeline-day-cell.is-due-date::before {
  content: '🚩';
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 8px;
}

/* MTG日当日のみのハイライト (受話器アイコン 📞) */
.timeline-day-cell.is-mtg-date {
  background-color: var(--color-mtg-bg) !important;
  color: var(--color-mtg-highlight) !important;
  font-weight: 700;
  border-bottom: 3px solid var(--color-mtg-highlight);
}
.timeline-day-cell.is-mtg-date::after {
  content: '📞';
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 8px;
}

/* 納期とMTG日が両方ある場合 */
.timeline-day-cell.is-due-date.is-mtg-date {
  background: linear-gradient(135deg, var(--color-due-bg) 50%, var(--color-mtg-bg) 50%) !important;
  border-bottom: 3px solid var(--color-due-highlight);
}

.gantt-body, .portfolio-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* カテゴリグループ & 上下ドラッグドロップ */
.gantt-track-group {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  transition: background-color 0.2s, border-color 0.2s;
}
.gantt-track-group.drag-over {
  background-color: rgba(59, 91, 169, 0.08);
  outline: 2px dashed var(--md-sys-color-primary);
  outline-offset: -2px;
}

.gantt-track-header {
  background-color: var(--md-sys-color-surface-container);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  left: 0;
  z-index: 2;
}

/* 空白ドロップエリア（ミニタスクドラッグ中のみ表示） */
.category-empty-drop-zone {
  display: none;
  height: 48px;
  border-bottom: 1px dashed var(--md-sys-color-outline-variant);
  transition: all 0.2s;
}
body.is-subtask-dragging .category-empty-drop-zone {
  display: flex;
  animation: dropZoneFadeIn 0.2s ease forwards;
}
@keyframes dropZoneFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.drop-zone-info-cell {
  width: 380px;
  min-width: 380px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  background-color: #faf9fd;
  color: var(--md-sys-color-primary);
  font-size: 12px;
  font-weight: 700;
}
.drop-zone-track {
  flex: 1;
  display: flex;
  align-items: center;
  padding-left: 20px;
  color: var(--md-sys-color-outline);
  font-size: 12px;
  background-color: #faf9fd;
}
.category-empty-drop-zone.subtask-drag-over {
  background-color: #ecfdf5;
  outline: 2px dashed #10b981;
  outline-offset: -2px;
}
.category-empty-drop-zone.subtask-drag-over .drop-zone-info-cell,
.category-empty-drop-zone.subtask-drag-over .drop-zone-track {
  background-color: #ecfdf5;
  color: #047857;
  font-weight: 700;
}

/* 大タスク行（ミニタスク複数段・重なり対応） */
.gantt-row {
  display: flex;
  min-height: 64px;
  border-bottom: 1px solid #f0edf2;
  transition: background-color 0.15s, opacity 0.2s;
  position: relative;
}
.gantt-row:hover {
  background-color: #faf9fd;
}
.gantt-row.is-dragging {
  opacity: 0.35;
  background-color: #e2e8f0;
}

/* ミニタスクのドロップ受け入れハイライト */
.gantt-row.subtask-drag-over {
  background-color: #eff6ff !important;
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
}

/* ミニタスクゼロの大タスク用プレースホルダーバー */
.gantt-empty-task-bar {
  position: absolute;
  top: 18px;
  height: 28px;
  border-radius: var(--m3-shape-corner-small);
  border: 2px dashed rgba(59, 91, 169, 0.35);
  background: rgba(59, 91, 169, 0.04);
  color: var(--md-sys-color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 10px;
  box-sizing: border-box;
  transition: all 0.2s;
  user-select: none;
  z-index: 1;
}
.gantt-empty-task-bar:hover {
  background: rgba(59, 91, 169, 0.1);
  border-color: var(--md-sys-color-primary);
}
.empty-task-bar-label {
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-info-cell {
  width: 380px;
  min-width: 380px;
  align-self: stretch;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  background-color: #ffffff;
  position: sticky;
  left: 0;
  z-index: 1;
}

.drag-grip-icon {
  color: var(--md-sys-color-outline);
  cursor: grab;
  font-size: 20px;
  user-select: none;
}
.drag-grip-icon:active {
  cursor: grabbing;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--md-sys-color-primary);
}

.task-title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.task-name-text {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.task-name-text.completed {
  text-decoration: line-through;
  color: var(--md-sys-color-outline);
}
.task-dates-text {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  display: flex;
  align-items: center;
  gap: 6px;
}

.assignees-stack {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}
.task-assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--m3-shape-corner-full);
  font-size: 10px;
  font-weight: 500;
  background-color: var(--md-sys-color-surface-container);
  white-space: nowrap;
}
.guest-tag {
  font-size: 8px;
  background-color: #ffd8a8;
  color: #d9480f;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 700;
}

.task-timeline-track {
  flex: 1;
  position: relative;
  display: block;
  height: 100%;
}

.timeline-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 44px;
  border-right: 1px dashed rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

/* 同一行内に複数並ぶミニタスクバー (DnD対応) */
.gantt-subtask-bar {
  position: absolute;
  height: 28px;
  border-radius: var(--m3-shape-corner-small);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  cursor: grab;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: box-shadow 0.15s, opacity 0.2s;
  overflow: visible;
  white-space: nowrap;
  user-select: none;
  z-index: 2;
}
.gantt-subtask-bar:active {
  cursor: grabbing;
}
.gantt-subtask-bar:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  filter: brightness(1.08);
}
.gantt-subtask-bar.is-completed {
  opacity: 0.65;
  background: #78909c !important;
  text-decoration: line-through;
}
.gantt-subtask-bar.is-subtask-dragging {
  opacity: 0.35;
}

.subtask-bar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.gantt-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: opacity 0.15s;
}
.gantt-subtask-bar:hover .gantt-bar-handle {
  opacity: 1;
}
.gantt-bar-handle.left {
  left: 0;
  border-top-left-radius: var(--m3-shape-corner-small);
  border-bottom-left-radius: var(--m3-shape-corner-small);
}
.gantt-bar-handle.right {
  right: 0;
  border-top-right-radius: var(--m3-shape-corner-small);
  border-bottom-right-radius: var(--m3-shape-corner-small);
}

/* タイムライン上のマイルストーンマーカー (納期: 🚩, MTG: 📞) */
.timeline-marker {
  position: absolute;
  top: 6px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.15s;
}
.timeline-marker:hover {
  transform: scale(1.2);
}
.timeline-marker.due {
  background: var(--color-due-bg);
  border: 1.5px solid var(--color-due-highlight);
}
.timeline-marker.mtg {
  background: var(--color-mtg-bg);
  border: 1.5px solid var(--color-mtg-highlight);
  color: var(--color-mtg-highlight);
}
.timeline-marker.mtg .material-symbols-outlined {
  font-size: 13px;
}

/* ホバー詳細カード */
.m3-hover-card {
  position: fixed;
  width: 310px;
  background: #ffffff;
  border-radius: var(--m3-shape-corner-medium);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--md-sys-color-outline-variant);
  padding: 14px 16px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.m3-hover-card.active {
  opacity: 1;
  transform: translateY(0);
}
.hover-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.hover-card-header h4 {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hover-card-header .badge {
  font-size: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.hover-card-meta {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.hover-card-desc {
  font-size: 12px;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container);
  padding: 8px 10px;
  border-radius: var(--m3-shape-corner-small);
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}
.hover-card-subtasks {
  font-size: 11px;
}
.hover-subtask-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 2px;
}

/* リスト表示エリア */
.list-section {
  flex: 1;
  display: flex;
  min-height: 0;
}
.list-card {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.list-track-group {
  margin-bottom: 24px;
}
.list-track-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--md-sys-color-surface-container);
}

.list-task-item {
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-medium);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s;
}
.list-task-item:hover {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.list-task-item.is-completed {
  opacity: 0.65;
  background-color: #f7f7f9;
}

.list-task-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.list-task-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-task-name {
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.list-task-name:hover {
  color: var(--md-sys-color-primary);
}
.list-task-name.completed {
  text-decoration: line-through;
  color: var(--md-sys-color-outline);
}

.list-task-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-task-desc {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container);
  padding: 8px 12px;
  border-radius: var(--m3-shape-corner-small);
  white-space: pre-wrap;
}

.list-subtasks-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 32px;
  border-left: 2px solid var(--md-sys-color-outline-variant);
  padding-left: 12px;
}
.subtask-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

/* 複数担当者選択 & ミニタスク担当者 */
.m3-multiselect-field {
  margin-bottom: 14px;
}
.assignee-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
  background: var(--md-sys-color-surface-container);
  padding: 10px;
  border-radius: var(--m3-shape-corner-small);
  max-height: 140px;
  overflow-y: auto;
}
.assignee-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}
.assignee-check-label input {
  accent-color: var(--md-sys-color-primary);
}

.add-subtask-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--md-sys-color-surface-container);
  padding: 10px;
  border-radius: var(--m3-shape-corner-small);
}
.add-subtask-box input {
  font-family: var(--font-family);
  height: 36px;
  padding: 0 10px;
  border-radius: var(--m3-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: #ffffff;
  outline: none;
}
.subtask-assignees-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.picker-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.picker-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--m3-shape-corner-full);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}
.picker-chip.selected {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 700;
}

.subtasks-management {
  margin-bottom: 16px;
}
.subtasks-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
  display: block;
}
.modal-subtask-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.modal-subtask-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--md-sys-color-surface-container);
  padding: 6px 12px;
  border-radius: var(--m3-shape-corner-small);
  font-size: 13px;
}

/* ポートフォリオ行 */
.portfolio-row {
  display: flex;
  height: 64px;
  border-bottom: 1px solid #f0edf2;
  transition: background-color 0.15s;
  cursor: pointer;
}
.portfolio-row:hover {
  background-color: #f7f5fa;
}
.portfolio-info-cell {
  width: 380px;
  min-width: 380px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  background-color: #ffffff;
  position: sticky;
  left: 0;
  z-index: 1;
}
.project-title-group {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project-name-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.project-meta-text {
  font-size: 11px;
  color: var(--md-sys-color-outline);
}
.members-avatar-stack {
  display: flex;
  align-items: center;
}
.member-avatar-chip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid #fff;
  margin-left: -6px;
}
.member-avatar-chip:first-child {
  margin-left: 0;
}

.portfolio-bar {
  position: absolute;
  height: 36px;
  border-radius: var(--m3-shape-corner-medium);
  background: linear-gradient(135deg, #3b5ba9, #536dfe);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  cursor: grab;
  user-select: none;
}
.portfolio-bar:active {
  cursor: grabbing;
}

/* Gitログ ドロワー & モーダル */
.history-drawer {
  position: fixed;
  top: 64px;
  right: -420px;
  width: 400px;
  bottom: 0;
  background-color: #ffffff;
  border-left: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 100;
}
.history-drawer.open {
  right: 0;
}
.drawer-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-with-icon .material-symbols-outlined {
  color: var(--md-sys-color-primary);
}
.drawer-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
.history-desc {
  font-size: 12px;
  color: var(--md-sys-color-outline);
  margin-bottom: 16px;
}
.git-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.git-timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background-color: var(--md-sys-color-outline-variant);
}
.commit-card {
  display: flex;
  gap: 12px;
  position: relative;
}
.commit-node {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.commit-node .material-symbols-outlined {
  font-size: 16px;
}
.commit-details {
  flex: 1;
  background-color: var(--md-sys-color-surface-container);
  padding: 12px 14px;
  border-radius: var(--m3-shape-corner-medium);
  font-size: 12px;
}
.commit-message {
  font-weight: 700;
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 4px;
}
.commit-meta {
  color: var(--md-sys-color-outline);
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.commit-diff {
  font-family: monospace;
  background: rgba(0,0,0,0.04);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--md-sys-color-primary);
}

.integration-box {
  background-color: var(--md-sys-color-surface-container);
  padding: 14px;
  border-radius: var(--m3-shape-corner-medium);
  margin-bottom: 16px;
}
.integration-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 8px;
}
.integration-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.integration-actions button {
  height: 36px;
  font-size: 12px;
}

.m3-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.m3-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.m3-modal-card {
  width: 100%;
  max-width: 580px;
  background: #ffffff;
  border-radius: var(--m3-shape-corner-large);
  padding: 24px 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ========================================================
   ヘッダー: 納期・MTGボタン ＆ 設定ドロップダウン
   ======================================================== */
.header-events-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  background-color: #e0f2fe;
  color: var(--color-mtg-highlight);
  font-weight: 700;
  border-radius: var(--m3-shape-corner-full);
}
.header-events-btn:hover {
  background-color: #bae6fd;
}
.header-badge {
  background-color: var(--color-due-highlight);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--m3-shape-corner-full);
  min-width: 18px;
  text-align: center;
}

.settings-dropdown-wrapper {
  position: relative;
}
.m3-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-medium);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  z-index: 150;
  display: none;
  animation: dropdownFade 0.15s ease forwards;
}
.m3-dropdown-menu.active {
  display: block;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background-color 0.15s;
}
.dropdown-item:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
}
.dropdown-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--md-sys-color-outline);
}
.dropdown-item:hover .material-symbols-outlined {
  color: var(--md-sys-color-primary);
}

/* ========================================================
   右下固定 フローティングアクションボタン (FAB)
   ======================================================== */
.m3-fab-extended {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  background-color: #ffffff;
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.m3-fab-extended:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  background-color: #f8fafc;
}
.m3-fab-extended:active {
  transform: translateY(0);
}
.m3-fab-extended.is-active {
  background-color: var(--md-sys-color-primary);
  color: #ffffff;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 6px 18px rgba(59, 91, 169, 0.35);
}
.m3-fab-extended.is-active .fab-icon {
  color: #ffffff;
}

/* ========================================================
   Discordアイコン ＆ アバター画像スタイル
   ======================================================== */
.member-avatar-img {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.header-avatar-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.avatar-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--m3-shape-corner-medium);
  margin-bottom: 16px;
}
.avatar-large-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-large-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.task-assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--m3-shape-corner-full);
  font-size: 11px;
  font-weight: 500;
  background-color: var(--md-sys-color-surface-container);
  white-space: nowrap;
}

/* ========================================================
   プロジェクトタグ関連スタイル
   ======================================================== */
.project-info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  flex-wrap: wrap;
}
.project-info-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.project-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}
.project-tags-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.project-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--m3-shape-corner-full);
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.15s;
}
.project-tag-chip.clickable:hover {
  background-color: #e2e8f0;
  cursor: pointer;
}
.project-tag-chip.active {
  background-color: var(--md-sys-color-primary);
  color: #ffffff;
  border-color: var(--md-sys-color-primary);
}
.project-tag-chip .remove-tag-btn {
  cursor: pointer;
  font-size: 14px;
  margin-left: 2px;
  color: inherit;
  opacity: 0.6;
}
.project-tag-chip .remove-tag-btn:hover {
  opacity: 1;
}

.project-period-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface-container);
  padding: 4px 12px;
  border-radius: var(--m3-shape-corner-full);
}

.project-portfolio-tags-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-tags-chips-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--m3-shape-corner-small);
}

.add-tag-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================================
   「あなたの納期・MTG一覧」モーダル内部リスト
   ======================================================== */
.my-events-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}
.my-event-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--m3-shape-corner-medium);
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.my-event-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.my-event-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}
.my-event-title-group {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.my-event-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.my-event-title:hover {
  color: var(--md-sys-color-primary);
}
.my-event-meta {
  font-size: 11px;
  color: var(--md-sys-color-outline);
  display: flex;
  align-items: center;
  gap: 6px;
}
.my-event-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================================
   モバイル・タブレット レスポンシブ対応 (Media Queries)
   768px以下 (タブレット・スマホ) / 480px以下 (小型スマホ)
   ======================================================== */

@media (max-width: 768px) {
  body {
    user-select: auto; /* モバイルでのテキスト選択性を向上 */
  }

  /* 1. トップアプリバーのモバイル最適化 */
  .m3-top-app-bar {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
  }

  .bar-left {
    gap: 8px;
  }

  .brand-text {
    font-size: 15px;
  }

  .main-nav-tabs {
    padding: 2px;
    gap: 2px;
  }

  .nav-tab-btn {
    padding: 5px 8px;
    font-size: 12px;
  }

  /* タブの長いテキストをアイコン+短縮名に */
  #nav-btn-home span:not(.material-symbols-outlined) {
    display: none;
  }
  #nav-btn-home::after {
    content: 'ホーム';
    font-size: 12px;
  }

  #nav-btn-projects span:not(.material-symbols-outlined) {
    display: none;
  }
  #nav-btn-projects::after {
    content: 'プロジェクト';
    font-size: 12px;
  }

  /* パンくずの短縮表示 */
  .nav-breadcrumbs {
    padding: 2px 6px;
    font-size: 11px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .breadcrumb-current {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .bar-right {
    gap: 6px;
  }

  /* ヘッダー納期・MTGボタンの文字をアイコン+バッジにスリム化 */
  .header-events-btn {
    height: 34px;
    padding: 0 8px;
    gap: 4px;
  }
  .header-events-btn span:nth-child(2) {
    display: none; /* 「納期・MTG」の文字を隠して受話器アイコンとバッジのみ表示 */
  }

  /* ユーザーチップは名前を非表示にしアバターのみ */
  .user-chip {
    padding: 2px;
    background: transparent;
  }
  #current-user-name {
    display: none;
  }
  .header-avatar-slot {
    width: 32px;
    height: 32px;
  }

  /* 2. メインコンテンツとページのパディング */
  .main-body {
    padding: 10px 12px;
    gap: 10px;
  }

  .page-container {
    gap: 12px;
  }

  /* 3. プロジェクト情報バナー & タグ */
  .project-info-banner {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .project-info-title-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .project-detail-title {
    font-size: 16px;
  }

  .project-period-badge {
    align-self: flex-start;
    font-size: 11px;
    padding: 3px 8px;
  }

  /* 4. コントロールパネルの縦積み・スクロール化 */
  .control-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .left-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .display-mode-switch {
    width: 100%;
    display: flex;
  }
  .display-mode-switch .mode-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 4px;
    font-size: 11px;
  }
  /* ボタンテキストの短縮 */
  #btn-mode-gantt span:not(.material-symbols-outlined) {
    display: none;
  }
  #btn-mode-gantt::after {
    content: 'ガント';
    font-size: 12px;
  }
  #btn-mode-list span:not(.material-symbols-outlined) {
    display: none;
  }
  #btn-mode-list::after {
    content: 'リスト';
    font-size: 12px;
  }

  /* カテゴリフィルターバーの横スクロール化 */
  .category-filters {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .control-panel .m3-button.filled {
    width: 100%;
    height: 38px;
  }

  /* 5. ガントチャート & ポートフォリオのサイドバー幅縮小 */
  .gantt-sidebar-header,
  .task-info-cell,
  .portfolio-info-cell {
    width: 170px !important;
    min-width: 170px !important;
    padding: 0 8px;
  }

  .gantt-sidebar-header {
    font-size: 11px;
  }

  .task-name-text,
  .project-name-text {
    font-size: 12px;
    max-width: 105px;
  }

  .drag-grip-icon {
    font-size: 16px;
  }

  .task-assignee-chip {
    padding: 1px 4px;
    font-size: 10px;
  }

  .timeline-day-cell {
    min-width: 36px;
    width: 36px;
    font-size: 10px;
  }

  /* 6. リスト表示の最適化 */
  .list-task-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }

  .list-task-main {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .list-task-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* 7. ホーム画面（マイスケジュール & 覚書） */
  .schedule-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .schedule-summary-badge {
    align-self: flex-start;
  }

  .notes-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 8. 右下固定FABのモバイル調整 */
  .m3-fab-extended {
    bottom: 20px;
    right: 16px;
    padding: 0 16px;
    height: 48px;
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  }

  /* 9. モーダル全般のモバイル幅 & スクロール対応 */
  .modal-overlay {
    padding: 12px;
    align-items: flex-end; /* 下部シート風 */
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh;
    border-radius: 20px 20px 12px 12px;
    padding: 20px 16px;
  }

  .form-row {
    flex-direction: column;
    gap: 8px;
  }

  /* 10. Git履歴ドロワーのモバイル全画面化 */
  .history-drawer {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 11. 設定ドロップダウンメニュー */
  .m3-dropdown-menu {
    right: 4px;
    width: 250px;
  }
}

@media (max-width: 480px) {
  .brand-text {
    display: none; /* 超小型画面ではロゴテキストを省略してアイコンのみに */
  }

  .gantt-sidebar-header,
  .task-info-cell,
  .portfolio-info-cell {
    width: 145px !important;
    min-width: 145px !important;
    padding: 0 6px;
  }

  .task-name-text,
  .project-name-text {
    max-width: 85px;
    font-size: 11px;
  }

  .timeline-day-cell {
    min-width: 32px;
    width: 32px;
  }

  .m3-fab-extended {
    padding: 0 12px;
    height: 44px;
    font-size: 12px;
  }
  #fab-filter-text {
    font-size: 11px;
  }
}

