:root {
  --primary: #00008b;
  --primary-dark: #000060;
  --bg: #f4f5f9;
  --card-bg: #ffffff;
  --text: #1f2233;
  --text-muted: #6b7080;
  --border: #e6e7ee;
  --green: #16a34a;
  --sidebar-w: 104px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { text-decoration: none; color: inherit; }

/* ---- ログイン画面 ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 16px;
  width: 340px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.login-card h1 {
  font-size: 20px;
  margin-bottom: 24px;
  text-align: center;
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-dark); }
.error-text { color: #e0245e; font-size: 13px; margin-bottom: 12px; }
.success-text { color: var(--green); font-size: 13px; margin-bottom: 12px; }

/* ---- ヘッダー(トップバー) ---- */
.topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
/* ---- アプリ全体レイアウト ---- */
.app-layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 8px 2px;
  border-radius: 8px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-align: center;
}
.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.nav-item .nav-label {
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nav-item:hover {
  background: var(--bg);
}
.nav-item.active {
  background: var(--primary);
  color: white;
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.user-chip {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-footer form { width: 100%; }
.sidebar-footer button {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-footer button svg { width: 18px; height: 18px; }

.main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px;
}

/* ---- 数値カード ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
}
.kpi-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-card .value { font-size: 24px; font-weight: 700; }
.kpi-card .value.placeholder { color: var(--text-muted); font-size: 15px; font-weight: 400; }

/* ---- コンテンツグリッド ---- */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 14px 0;
}
.announcement-item, .task-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.announcement-item:last-child, .task-item:last-child { border-bottom: none; }
.link-title {
  font-weight: 600;
  color: var(--primary);
}
.link-title:hover { color: var(--primary-dark); text-decoration: underline; }
.empty-note { color: var(--text-muted); font-size: 13px; }

.attendance-box {
  text-align: center;
  padding: 20px 0;
}
.attendance-status { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.attendance-btn {
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: white;
}
.attendance-btn.checkin { background: var(--primary); }
.attendance-btn.checkout { background: #444a5e; }

/* ---- ユーザー管理 ---- */
table.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.user-table th, table.user-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-inline input, .form-inline select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.form-inline button {
  padding: 8px 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.badge { padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.badge.admin { background: #fde68a; color: #92400e; }
.badge.member { background: #e6e7ee; color: var(--text-muted); }

/* ---- タスク管理(カンバン) ---- */
.kanban-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
}
.kanban-column {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  min-height: 200px;
  min-width: 160px;
}
.kanban-column h3 {
  font-size: 14px;
  margin: 0 0 10px 0;
  color: var(--text-muted);
}
.kanban-column h3 .count { color: #b0b3c0; font-weight: 400; }
.kanban-list {
  min-height: 100px;
  border-radius: 8px;
  transition: background 0.1s;
}
.kanban-list.drag-over { background: #eef0ff; }
.kanban-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  cursor: grab;
  font-size: 13px;
  /* タッチ操作をブラウザのスクロールではなくドラッグ判定に使うため */
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}
.kanban-card-title { font-weight: 600; margin-bottom: 4px; }
.kanban-card-meta { color: var(--text-muted); font-size: 12px; }
.kanban-card-meta .due-overdue { color: #d03b3b; font-weight: 600; }
.kanban-card-placeholder { opacity: 0.35; }
.kanban-card-dragging-clone {
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  cursor: grabbing;
}
.mini-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-block;
}

/* ---- カレンダー ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 6px;
}
.calendar-cell {
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font-size: 11px;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card-bg);
  transition: background 0.15s;
}
a.calendar-cell:hover { background: var(--bg); }
.calendar-cell.empty { border: none; background: none; }
.calendar-day { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.calendar-task {
  background: #eef0ff;
  color: var(--primary-dark);
  border-radius: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- イベントカレンダー(EC売上ページ) ---- */
.event-cell {
  position: relative;
  overflow: visible;
}
.event-cell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.event-cell-head .calendar-day { margin-bottom: 0; }
.event-add-toggle summary,
.event-chip-toggle summary {
  cursor: pointer;
  list-style: none;
}
.event-add-toggle summary::-webkit-details-marker,
.event-chip-toggle summary::-webkit-details-marker { display: none; }
.event-add-toggle summary::marker,
.event-chip-toggle summary::marker { content: ''; }
.event-add-toggle summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}
.event-add-toggle[open] summary { background: var(--primary); color: #fff; }
.event-chip {
  display: block;
  background: #ffe3ee;
  color: #9c3f66;
  border-radius: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-chip-toggle[open] .event-chip { background: #ffcfe0; }
.event-popover {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  width: 220px;
  max-width: 80vw;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 12px;
  white-space: normal;
  font-size: 12px;
}
.event-popover label {
  display: block;
  color: var(--text-muted);
  margin: 8px 0 3px;
}
.event-popover label:first-of-type { margin-top: 0; }
.event-popover input[type="date"],
.event-popover input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  box-sizing: border-box;
}
.event-popover button {
  margin-top: 10px;
  width: 100%;
  padding: 7px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.event-popover form + form { margin-top: 8px; }
.event-delete-btn {
  background: #fff !important;
  color: #d03b3b !important;
  border: 1px solid #f0c4c4 !important;
}

/* ---- イベントカレンダー(ホーム画面・表示専用のミニ版) ---- */
.calendar-grid-mini .calendar-cell {
  min-height: 44px;
  padding: 4px;
  font-size: 10px;
}
.calendar-grid-mini .calendar-day { font-size: 10px; margin-bottom: 2px; }
.calendar-grid-mini .event-chip { padding: 1px 3px; }

@media (max-width: 900px) {
  .kanban-grid { grid-auto-flow: row; grid-auto-columns: unset; }
  .kanban-column { min-width: unset; }
}

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

/* ---- タスク: 担当者チェックリスト ---- */
.assignee-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.assignee-check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.assignee-check input { margin: 0; }

/* ---- タスク: 画像添付ギャラリー ---- */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.attachment-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  text-align: center;
}
.attachment-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
  display: block;
}
.attachment-file-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 6px;
}
.attachment-file-icon { font-size: 36px; }
.attachment-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.attachment-actions .mini-btn { text-align: center; }
.attachment-name {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.mini-btn.active-filter {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ---- ナレッジ共有(Markdown表示) ---- */
.markdown-body { line-height: 1.7; font-size: 14px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 20px; margin-bottom: 10px; }
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body p { margin: 8px 0; }
.markdown-body code {
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.markdown-body pre {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body ul, .markdown-body ol { padding-left: 22px; }
.markdown-body a { color: var(--primary); text-decoration: underline; }
.markdown-body table { border-collapse: collapse; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 10px; }
.markdown-body blockquote {
  border-left: 3px solid var(--border);
  margin: 8px 0;
  padding-left: 12px;
  color: var(--text-muted);
}

/* ---- 表計算 ---- */
table.sheet-table {
  border-collapse: collapse;
  font-size: 13px;
}
table.sheet-table th, table.sheet-table td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
}
table.sheet-table thead th {
  background: var(--bg);
  padding: 6px;
  color: var(--text-muted);
  min-width: 90px;
}
table.sheet-table tbody th {
  background: var(--bg);
  color: var(--text-muted);
  width: 32px;
  padding: 6px;
}
table.sheet-table td input {
  width: 100%;
  min-width: 90px;
  border: none;
  padding: 6px;
  font-size: 13px;
  text-align: right;
  font-family: monospace;
}
table.sheet-table td input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
table.sheet-table.readonly td {
  padding: 6px 10px;
  text-align: right;
  font-family: monospace;
}

/* ---- ページ共通ヘッダー(タイトル + 新規登録ボタン) ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header h1 {
  font-size: 18px;
  margin: 0;
}
.new-toggle { position: relative; flex-shrink: 0; }
.new-toggle summary {
  cursor: pointer;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  font-size: 13px;
  list-style: none;
  white-space: nowrap;
  user-select: none;
}
.new-toggle summary::-webkit-details-marker { display: none; }
.new-toggle summary::marker { content: ''; }
.new-toggle[open] summary { background: var(--primary-dark); }
.new-toggle-btn {
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.new-toggle-btn:hover { background: var(--primary-dark); }

/* ---- タスク管理: ボード/カレンダーの切り替えタブ ---- */
.task-view-tabs {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.task-view-tab {
  border: none;
  background: transparent;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.task-view-tab.active {
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ---- タスク管理: プロジェクト/社内全体タスクの切り替えボタン ---- */
.project-toggle-btn {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 6px 16px;
  background: #ffd9e6;
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.project-toggle-btn:hover {
  background: #ffc4da;
}

/* ---- タスクの登録・編集画面(一覧の右側からスライドインするパネル) ---- */
.task-detail-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 50%;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 200;
  overflow-y: auto;
  padding: 28px 32px 40px;
}
.task-detail-panel.open { transform: translateX(0); }
.task-panel-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.task-panel-close:hover { background: var(--border); color: var(--text); }

.task-delete-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.task-delete-btn {
  padding: 8px 18px;
  background: #fff;
  color: #d03b3b;
  border: 1px solid #f0c4c4;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.task-delete-btn:hover { background: #fdf1f1; }

@media (max-width: 900px) {
  .task-detail-panel { width: 100%; }
}

.new-form-panel {
  position: absolute;
  right: 0;
  top: 42px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.10);
  z-index: 20;
  min-width: 320px;
}
.new-form-panel h2 { font-size: 14px; margin: 0 0 12px 0; }
.new-form-panel .form-inline, .new-form-panel form { flex-wrap: wrap; }
.new-form-panel input, .new-form-panel select, .new-form-panel textarea {
  width: 100%;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .new-form-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    width: auto;
    min-width: 0;
  }
}

/* ---- ファイル添付のドラッグ&ドロップ欄 ---- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover {
  border-color: var(--primary);
  background: #eef0ff;
  color: var(--primary-dark);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-filelist {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

/* ---- タスクのやり取り(コメント+添付ファイル)タイムライン ---- */
.timeline { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.timeline-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg);
}
.timeline-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.timeline-item-head .name { font-weight: 600; color: var(--text); }
.timeline-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.timeline-item-meta form { margin: 0; }
.timeline-delete-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}
.timeline-delete-link:hover { color: #d03b3b; }
.timeline-item-body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.timeline-item .attachment-grid { margin-top: 10px; }
.timeline-item .attachment-actions { margin-top: 8px; }
.timeline-item .attachment-actions .mini-btn { margin-top: 0; }
.comment-composer textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 10px;
}

/* ---- ユーザーアイコン(アバター) ---- */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}
.avatar-xs { width: 18px; height: 18px; font-size: 11px; }
.avatar-sm { width: 22px; height: 22px; font-size: 12px; }
.avatar-md { width: 30px; height: 30px; font-size: 15px; }
.avatar-lg { width: 64px; height: 64px; font-size: 30px; }

.avatar-group {
  display: inline-flex;
  align-items: center;
}
.avatar-group .avatar {
  border: 2px solid var(--panel-bg, #fff);
}
.avatar-group .avatar + .avatar { margin-left: -7px; }

.assignee-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.assignee-inline .names { color: var(--text-muted); }

.assignee-check-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timeline-item-head .name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.updated-by-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-task {
  display: flex;
  align-items: center;
  gap: 4px;
}

.announcement-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---- お知らせ一覧(タイトルのみ表示、既読/未読) ---- */
.announcement-list {
  display: flex;
  flex-direction: column;
}
.announcement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.announcement-row:last-child { border-bottom: none; }
.announcement-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.announcement-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement-row.is-unread .announcement-row-title { font-weight: 700; }
.announcement-row.is-read .announcement-row-title { color: var(--text-muted); font-weight: 400; }
.unread-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.announcement-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.announcement-row-date {
  color: #b0b3c0;
  font-size: 12px;
  white-space: nowrap;
}

/* ---- アイコン設定画面 ---- */
.icon-picker-section { margin-bottom: 20px; }
.icon-picker-section h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.icon-option {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: white;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-option.selected {
  border-color: var(--primary);
  background: #eef0ff;
}
.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-option.selected {
  border-color: #222;
  box-shadow: 0 0 0 2px white inset;
}
.icon-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.avatar-img {
  object-fit: cover;
  background: var(--bg);
}

.user-chip-link {
  display: inline-flex;
  text-decoration: none;
}

/* ---- お知らせの添付ファイル(サムネイルなし・シンプルなリスト表示) ---- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.file-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.file-list-item .file-icon { font-size: 18px; flex-shrink: 0; }
.file-list-item .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.file-list-item .file-name:hover { color: var(--primary); }
.file-list-item form { margin: 0; }
.file-list-item .file-download-link {
  flex-shrink: 0;
  color: var(--primary);
  text-decoration: underline;
  font-size: 12px;
  white-space: nowrap;
}
.file-list-item .file-download-link:hover { color: var(--primary-dark); }

/* ---- 外注先リスト(カテゴリごとにグルーピング表示) ---- */
.vendor-category-panel { margin-bottom: 20px; }
.vendor-category-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.vendor-category-head .badge {
  font-weight: 600;
  padding: 4px 12px;
}
.vendor-category-count { color: var(--text-muted); font-size: 13px; }

/* ---- 共有シート(タイトルのみのカード表示。横並びにせず縦に積む) ---- */
.link-card-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  background: var(--card-bg);
}
.link-card-title {
  font-weight: 600;
  color: var(--primary);
  word-break: break-word;
  text-decoration: none;
}
.link-card-title:hover { text-decoration: underline; }
.link-card-delete { flex-shrink: 0; margin-left: 16px; }

/* ---- ホーム画面(管理者向け)本日のメンバー出勤状況 ---- */
.team-attendance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team-attendance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
}
.attendance-badge-in { background: #3fae5c; color: white; }
.attendance-badge-out { background: #9aa0ae; color: white; }
.attendance-badge-none { background: #f0ad4e; color: white; }

/* ---- チャット・通話 ---- */
.chat-layout { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
.chat-peers { list-style: none; margin: 0; padding: 0; }
.chat-peer { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 14px; }
.chat-peer.active { background: rgba(0,0,0,0.04); border-radius: 6px; }
.chat-peer-name { cursor: pointer; flex: 1; }
.chat-dot { width: 9px; height: 9px; border-radius: 50%; background: #c9ccd6; flex: none; }
.chat-dot.on { background: #2fb344; }
.chat-unread { background: #e0245e; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.chat-thread-title { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.chat-log { height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fafbfd; }
.chat-msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.chat-msg.mine { align-items: flex-end; }
.chat-msg.theirs { align-items: flex-start; }
.chat-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; background: #fff; border: 1px solid var(--border); }
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.chat-form { display: flex; gap: 8px; margin-top: 8px; }
.chat-form input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.chat-form button { padding: 8px 16px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.chat-form button:disabled, .chat-form input:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-error { color: #e0245e; font-size: 12px; margin-top: 6px; }

/* ---- 音声 ---- */
.voice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.voice-enable { padding: 6px 14px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.voice-enable:disabled { background: #9aa0b4; cursor: default; }
.voice-mute { padding: 6px 14px; background: #fff; color: var(--primary); border: 1px solid var(--primary); border-radius: 8px; cursor: pointer; }
.voice-mute.on { background: #6b7080; border-color: #6b7080; color: #fff; }
.voice-note { color: var(--text-muted); font-size: 12px; }
.voice-speaking { background: #e8f7ec; color: #1d7a34; border-radius: 8px; padding: 6px 12px; font-size: 13px; margin-bottom: 10px; }
.voice-error { color: #e0245e; font-size: 12px; margin-bottom: 8px; }
.talk-btn { padding: 6px 12px; border: 1px solid var(--primary); background: #fff; color: var(--primary); border-radius: 8px; cursor: pointer; font-size: 13px; touch-action: none; user-select: none; }
.talk-btn.talking { background: #e0245e; border-color: #e0245e; color: #fff; }
.talk-btn:disabled { opacity: 0.4; cursor: not-allowed; }
