/* Director+ Mock - Design Tokens & Components */

:root {
  --color-primary: #E5484D;
  --color-primary-hover: #D6393F;
  --color-primary-light: #FFF5F5;
  --color-text: #1F2937;
  --color-text-secondary: #6B7280;
  --color-border: #E5E7EB;
  --color-surface: #FAFBFC;
  --color-white: #FFFFFF;
  --sidebar-width: 280px;
  --header-height: 64px;
  --footer-height: 48px;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--color-text);
  background-color: var(--color-surface);
}

/* App shell: full-width header + sidebar below */
body.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--header-height);
}

body.app-shell > #header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  flex-shrink: 0;
}

body.app-shell > #footer {
  flex-shrink: 0;
}

body.app-shell > .app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

body.app-shell #sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

/* App footer */
.app-footer {
  background: white;
  border-top: 1px solid var(--color-border);
  min-height: var(--footer-height);
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--footer-height);
  padding: 0 24px;
  text-align: center;
}

/* Header dropdowns */
.header-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 320px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.header-dropdown-menu--user {
  min-width: 200px;
}

.header-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.header-dropdown-body {
  max-height: 360px;
  overflow-y: auto;
}

.notification-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--color-border);
  transition: background 150ms ease;
}

.notification-dropdown-item:last-child {
  border-bottom: none;
}

.notification-dropdown-item:hover {
  background: var(--color-surface);
}

.notification-dropdown-item.unread {
  background: var(--color-primary-light);
}

.notification-dropdown-item.unread:hover {
  background: #FFE8E8;
}

.notification-dropdown-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.notification-dropdown-item.unread .notification-dropdown-icon {
  background: white;
}

.notification-dropdown-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}

.notification-dropdown-body-text {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.notification-dropdown-time {
  display: block;
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 4px;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.header-dropdown-user-info {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--color-text);
  text-decoration: none;
  transition: background 150ms ease;
}

.header-dropdown-item:hover {
  background: var(--color-surface);
}

.header-dropdown-item--danger {
  color: #DC2626;
  border-top: 1px solid var(--color-border);
}

.header-dropdown-item--danger:hover {
  background: #FEF2F2;
}

.header-dropdown.open .header-dropdown-trigger {
  background: #F3F4F6;
}

/* Header: ワークスペース切替 */
.workspace-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #374151;
}

.workspace-switcher--static {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #F9FAFB;
  font-size: 13px;
  color: #6B7280;
}

.workspace-switcher-icon {
  display: inline-flex;
  color: #9CA3AF;
  flex-shrink: 0;
}

.workspace-switcher-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-switcher-menu {
  min-width: 280px;
}

.workspace-switcher-body {
  padding: 4px;
}

.workspace-switcher-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}

.workspace-switcher-item:hover {
  background: var(--color-surface);
}

.workspace-switcher-item.active {
  background: var(--color-primary-light);
}

.workspace-switcher-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.workspace-switcher-item-meta {
  font-size: 11px;
  color: #6B7280;
  margin-top: 2px;
}

.workspace-switcher-check {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary);
  font-weight: 700;
}

.workspace-switcher-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--color-border);
}

.workspace-context-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  font-size: 13px;
  color: #0369A1;
}

/* Header: AI ミナに相談ボタン */
.mina-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(229, 72, 77, 0.25);
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.mina-header-btn:hover {
  background: #FFE8E8;
  border-color: var(--color-primary);
}

.mina-header-btn.active,
.mina-header-btn[aria-expanded="true"] {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.mina-header-btn-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
  line-height: 0;
}

.mina-header-btn.active .mina-header-btn-icon,
.mina-header-btn[aria-expanded="true"] .mina-header-btn-icon {
  border-color: white;
}

.mina-header-btn.active .mina-avatar-img,
.mina-header-btn[aria-expanded="true"] .mina-avatar-img {
  border-color: white !important;
}

.mina-card {
  background: var(--color-primary-light);
  border-left: 4px solid var(--color-primary);
  border-radius: 12px;
  padding: 20px 24px;
}

/* AI ミナ アバター画像（全画面共通・インライン style / Tailwind と併用） */
img.mina-avatar-img {
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: center top;
  display: block !important;
  flex-shrink: 0 !important;
  max-width: none !important;
  max-height: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 150ms ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-gray { background: #F3F4F6; color: #4B5563; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-yellow { background: #FEF3C7; color: #B45309; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--color-text-secondary);
  transition: all 150ms ease;
  text-decoration: none;
}

.sidebar-link:hover {
  background: #F3F4F6;
  color: var(--color-text);
}

.sidebar-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-section-label {
  padding: 0 16px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9CA3AF;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}

.data-table tr:hover td {
  background: #FAFBFC;
}

/* Kanban */
#kanban-board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.kanban-column {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  flex: 0 0 280px;
  background: #F3F4F6;
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
}

.kanban-column-body {
  min-width: 0;
  min-height: 64px;
  border-radius: 8px;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.kanban-column-body.drag-over {
  background: rgba(229, 72, 77, 0.08);
  box-shadow: inset 0 0 0 2px rgba(229, 72, 77, 0.25);
}

.kanban-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 150ms ease;
  overflow: hidden;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card-project {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #F3F4F6;
}

.kanban-assignee {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kanban-card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-title .record-id {
  display: inline;
  margin-right: 0.25rem;
  white-space: nowrap;
}

/* Task view toggle */
.task-view-toggle button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
}

.task-view-toggle button.active {
  background: white;
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Gantt chart */
.gantt-wrap {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.gantt-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.gantt-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.gantt-range-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.gantt-range-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.gantt-preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gantt-preset-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms ease;
}

.gantt-preset-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gantt-preset-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gantt-date-input {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  color: var(--color-text);
}

.gantt-date-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(229, 72, 77, 0.1);
}

.gantt-range-sep {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.gantt-range-apply {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  font-family: inherit;
}

.gantt-range-apply:hover {
  background: var(--color-primary-hover);
}

.gantt-range-nav {
  display: flex;
  gap: 4px;
}

.gantt-range-nav button {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-family: inherit;
  color: var(--color-text-secondary);
}

.gantt-range-nav button:hover {
  background: #F3F4F6;
  color: var(--color-text);
}

.gantt-range-hint {
  font-size: 11px;
  color: #9CA3AF;
}

.gantt-range-error {
  font-size: 12px;
  color: #DC2626;
  display: none;
}

.gantt-range-error.visible {
  display: block;
}

.gantt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gantt-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.gantt-scroll {
  overflow: auto;
  max-height: 640px;
}

.gantt-grid {
  display: grid;
  min-width: 900px;
}

.gantt-header-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  position: sticky;
  top: 0;
  z-index: 5;
  background: white;
  border-bottom: 1px solid var(--color-border);
}

.gantt-header-label {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.gantt-timeline-header {
  display: flex;
  background: var(--color-surface);
  position: relative;
  flex: 1;
}

.gantt-task-timeline {
  position: relative;
  display: flex;
  flex: 1;
}

.gantt-day-cell {
  flex: 1;
  min-width: 36px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-secondary);
  border-right: 1px solid #F3F4F6;
}

.gantt-day-cell.is-weekend {
  background: #FAFAFA;
}

.gantt-day-cell.is-today {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
}

.gantt-day-num {
  display: block;
  font-size: 13px;
  color: var(--color-text);
  font-weight: 600;
}

.gantt-day-cell.is-today .gantt-day-num {
  color: var(--color-primary);
}

.gantt-day-cell--grid {
  padding: 0;
  min-height: 100%;
}

.gantt-day-cell--grid.is-today {
  font-weight: 400;
}

.gantt-project-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  background: #F9FAFB;
  border-bottom: 1px solid var(--color-border);
}

.gantt-project-label {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  border-right: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gantt-project-timeline {
  position: relative;
  min-height: 36px;
}

.gantt-task-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  border-bottom: 1px solid #F3F4F6;
  min-height: 44px;
}

.gantt-task-row:hover {
  background: #FAFBFC;
}

.gantt-task-label {
  padding: 8px 12px 8px 24px;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.gantt-task-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-task-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.gantt-task-timeline .gantt-day-cell {
  pointer-events: none;
  flex: 1;
  min-width: 36px;
}

.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: filter 150ms ease;
  z-index: 2;
}

.gantt-bar:hover {
  filter: brightness(1.05);
  z-index: 3;
}

.gantt-bar--todo { background: #9CA3AF; }
.gantt-bar--doing { background: #F59E0B; }
.gantt-bar--review { background: #3B82F6; }
.gantt-bar--returned { background: #EF4444; }
.gantt-bar--done { background: #16A34A; opacity: 0.75; }

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-primary);
  z-index: 4;
  pointer-events: none;
}

.gantt-today-line::before {
  content: '今日';
  position: absolute;
  top: -2px;
  left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.gantt-milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--color-primary);
  z-index: 3;
}

.review-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(229, 72, 77, 0.4);
  z-index: 10;
}

.review-pin.resolved {
  background: #9CA3AF;
  box-shadow: none;
}

.review-pin.active {
  transform: translate(-50%, -50%) scale(1.15);
}

/* Comment thread */
.comment-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.comment-item:last-child {
  border-bottom: none;
}

/* Video timeline marker */
.timeline-marker {
  position: absolute;
  top: -4px;
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border: 2px solid white;
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: pointer;
}

/* Tabs */
.tab-btn {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 500;
}

.tab-btn:hover:not(.active) {
  color: var(--color-text);
}

/* Form */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: border-color 150ms ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.1);
}

/* Stat card */
.stat-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px 24px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-text);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 200ms ease;
}

/* Mina chat panel（ヘッダーから開く） */
.mina-chat {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  right: 24px;
  z-index: 55;
  pointer-events: none;
}

.mina-chat.open {
  pointer-events: auto;
}

.mina-chat-panel {
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - var(--header-height) - 32px);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: all 200ms ease;
  overflow: hidden;
  pointer-events: auto;
}

.mina-chat.open .mina-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.mina-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-primary-light);
  border-left: 4px solid var(--color-primary);
  flex-shrink: 0;
}

.mina-chat-close {
  padding: 6px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease;
}

.mina-chat-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text);
}

.mina-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-surface);
}

.mina-chat-bubble {
  display: flex;
  gap: 8px;
  max-width: 88%;
}

.mina-chat-bubble--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.mina-chat-bubble--user .mina-chat-bubble-content {
  background: var(--color-primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.mina-chat-bubble--mina .mina-chat-bubble-content {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 4px 16px 16px 16px;
}

.mina-chat-bubble-avatar {
  flex-shrink: 0;
  align-self: flex-end;
  line-height: 0;
}

.mina-chat-bubble-content {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text);
}

.mina-chat-bubble-content p {
  margin: 0;
}

.mina-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: white;
  flex-shrink: 0;
}

.mina-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.mina-chat-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.1);
}

.mina-chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 150ms ease;
}

.mina-chat-send:hover {
  background: var(--color-primary-hover);
}

@media (max-width: 640px) {
  .mina-chat {
    top: calc(var(--header-height) + 4px);
    right: 12px;
    left: 12px;
  }

  .mina-chat-panel {
    width: 100%;
    max-width: none;
  }

  .mina-header-btn-label {
    display: none;
  }

  .mina-header-btn {
    padding: 8px 10px;
  }
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Screen index */
.screen-index-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: all 150ms ease;
}

.screen-index-link:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.screen-index-link .badge {
  margin-left: 8px;
}

/* Phase1: 修正指示書 */
.instruction-comment-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.instruction-comment-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.instruction-category {
  padding: 12px;
  background: var(--color-surface);
  border-radius: 8px;
}

.instruction-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px;
  max-height: 560px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
}

/* Phase1: タグチップ */
.tag-chip {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: white;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}

.tag-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tag-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Phase1: アクティビティタイムライン */
.activity-timeline {
  position: relative;
}

.activity-date-group {
  margin-bottom: 32px;
}

.activity-date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.activity-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.activity-icon--ai {
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
  width: auto;
  height: auto;
}
.activity-icon--comment { background: #EFF6FF; border-color: #BFDBFE; }
.activity-icon--task { background: #F0FDF4; border-color: #BBF7D0; }
.activity-icon--slack { background: #F5F3FF; border-color: #DDD6FE; }
.activity-icon--file { background: #FFFBEB; border-color: #FDE68A; }
.activity-icon--review { background: #FFF5F5; border-color: #FECACA; }
.activity-icon--project { background: #F9FAFB; border-color: var(--color-border); }

.activity-content {
  flex: 1;
  min-width: 0;
}

/* Phase1: Slack受信トレイ */
.slack-message-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.slack-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.slack-channel {
  font-size: 13px;
  font-weight: 600;
  color: #4A154B;
  background: #F5EEFA;
  padding: 2px 8px;
  border-radius: 4px;
}

.slack-message-body {
  padding: 16px;
}

.slack-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: #FAFBFC;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.modal-close {
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

.modal-content--wide {
  max-width: 560px;
}

/* Phase2: ナレッジドキュメント */
.knowledge-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.knowledge-file-icon--pdf { background: #FEE2E2; color: #B91C1C; }
.knowledge-file-icon--md { background: #E0E7FF; color: #3730A3; }
.knowledge-file-icon--doc { background: #DBEAFE; color: #1D4ED8; }
.knowledge-file-icon--txt { background: #F3F4F6; color: #4B5563; }

.knowledge-scope {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.knowledge-scope--workspace { background: #F3F4F6; color: #374151; }
.knowledge-scope--client { background: #EDE9FE; color: #5B21B6; }
.knowledge-scope--project { background: #FFF5F5; color: #E5484D; }

.knowledge-doc-card {
  display: block;
  padding: 16px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease;
}

.knowledge-doc-card:hover {
  border-color: var(--color-primary);
}

.knowledge-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  background: var(--color-surface);
  transition: border-color 150ms ease, background 150ms ease;
}

.knowledge-dropzone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.knowledge-preview h3,
.knowledge-preview h4 {
  color: var(--color-text);
}

.data-table th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.record-id {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #9CA3AF;
  letter-spacing: 0.02em;
  margin-right: 8px;
  flex-shrink: 0;
}

/* 案件詳細: ナレッジタブ */
.project-knowledge-section {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
}

.project-knowledge-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.project-knowledge-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.project-knowledge-item--owned {
  border-left: 3px solid var(--color-primary);
}

.project-knowledge-item--linked {
  border-left: 3px solid #3B82F6;
}

.project-knowledge-item--inherited {
  border-left: 3px solid #9CA3AF;
  background: var(--color-surface);
}

.project-knowledge-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.project-knowledge-collapse-trigger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.project-knowledge-chevron.rotate-180 {
  transform: rotate(180deg);
}

.project-knowledge-link-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.project-knowledge-link-option:hover:not(.opacity-50) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.project-knowledge-link-option .knowledge-file-icon {
  width: 32px;
  height: 32px;
  font-size: 8px;
}
