/* ============================================================
   FAG 進捗管理 — components & layout
   設計言語: Horizon UI（tokens.css のトークンのみ参照、
   コンポーネント内に色のハードコードはしない）
   ============================================================ */

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

html { height: 100%; }

body {
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, select, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.num { font-variant-numeric: tabular-nums; }

::selection { background: var(--primary-soft); }

@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--label-4);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

/* ---------- sidebar（Horizon: 白、右端アクティブバー） ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-right: 1px solid var(--color-separator);
  overflow-y: auto;
  padding: 28px 0 18px;
  gap: 2px;
  z-index: var(--z-chrome);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 0 26px 16px;
  margin-bottom: 8px;
  position: relative;
}

.brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  flex: none;
}

/* 会社ロゴ（透過PNG）。ダークでは紺文字が沈むため白地 badge を敷く */
.brand-logo { display: inline-flex; align-items: center; }
.brand-logo img { height: 36px; width: auto; display: block; }
.brand-logo.lg img { height: 46px; }


.brand-name { font-size: 16.5px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted-foreground); }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 16px);
  margin: 1px 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.nav-item:active { background: var(--fill); }

.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { color: var(--foreground); }
.nav-item.active { color: var(--foreground); font-weight: 700; }
.nav-item.active { background: var(--color-surface-selected); color: var(--color-accent-text); }
.nav-item.active:hover { background: var(--color-surface-selected); color: var(--color-accent-text); }
.nav-item.active svg { color: var(--color-accent); }

.nav-item .count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
}

.side-heading {
  margin: 20px 26px 8px;
  /* 上のナビ項目と同じ文字サイズに統一 */
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-collapse {
  display: flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--muted-foreground);
  cursor: pointer;
}

/* 折りたたみシェブロンは大きく・目立つように（背景付き） */
.side-collapse .chev {
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 8px;
  background: var(--fill-2);
  transition: transform var(--t-fast) var(--ease-out);
}
#side-projects-head.collapsed .chev { transform: rotate(-90deg); }
.side-collapse:hover { color: var(--foreground); }
.side-collapse:hover .chev { background: var(--fill); }

.side-add {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  background: var(--fill-2);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.side-add svg { width: 15px; height: 15px; }
.side-add:hover { background: var(--fill-2); color: var(--foreground); }

#side-projects .nav-item { min-height: 38px; font-size: 13.5px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.side-foot {
  margin-top: auto;
  padding: 16px 18px 0;
  display: grid;
  gap: 9px;
}

.side-foot .hint {
  padding: 0 8px;
  font-size: 11px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--fill-2);
  color: var(--subtle-foreground);
}

/* ---------- main / topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-chrome);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--header);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.sidebar-toggle { flex: none; margin-left: -6px; margin-right: 2px; }

/* サイドバー非表示（デスクトップ） */
body.sidebar-hidden .shell { grid-template-columns: 1fr; }
body.sidebar-hidden .sidebar { display: none; }


.topbar h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.topbar .spacer { flex: 1; }

/* Horizon: 右上の浮遊カプセル */
.top-capsule {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--color-separator);
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  width: 230px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--color-surface-secondary);
  color: var(--color-text-secondary);
  transition: background var(--t-fast) var(--ease-out);
}

.searchbox:hover { background: var(--fill); }
.searchbox svg { width: 15px; height: 15px; flex: none; }
.searchbox .label { font-size: 13px; color: var(--color-text-secondary); }
.searchbox kbd { margin-left: auto; background: var(--card); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--fill-2); color: var(--foreground); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm svg { width: 15px; height: 15px; }

.top-avatar { border-radius: 50%; display: grid; place-items: center; transition: transform var(--t-fast) var(--ease-out); }
.top-avatar:active { transform: scale(0.94); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:active { background: var(--color-accent-pressed); }
.btn-tinted { background: var(--primary-soft); color: var(--primary-strong); }
.btn-gray { background: var(--fill-2); color: var(--foreground); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ---------- content / views ---------- */
.content { flex: 1; min-width: 0; }

.view { display: none; }
.view.active { display: block; }

.view-pad {
  padding: 8px 28px 40px;
  max-width: 1180px;
  margin: 0 auto;
}

.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.page-head .sub { margin-top: 2px; font-size: 13px; color: var(--subtle-foreground); }

/* ---------- toolbar / filter ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 28px 14px;
}

#list-toolbar, #library-toolbar {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.toolbar.gantt-tb { display: block; }
.gantt-tb .tb-row { display: flex; align-items: center; gap: 8px; }
.gantt-tb .tb-row + .tb-row { margin-top: 10px; }
.gantt-tb .tb-row .chips { flex: 1; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

/* チップ列は行内で縮んで横スクロール（クリア等の.rightを行外へ押し出さない） */
.toolbar .chips { flex: 1 1 0%; }

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  background: var(--fill-2);
  color: var(--subtle-foreground);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.chip:active { transform: scale(0.96); }
.chip.on { background: var(--primary); color: var(--primary-foreground); }
.chip .x { display: grid; place-items: center; margin-right: -4px; }
.chip .x svg { width: 13px; height: 13px; }
.chip .chip-n { font-size: 11px; opacity: 0.7; font-weight: 700; }

.select { position: relative; flex: none; }

.select select {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  padding: 0 30px 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--fill-2);
  color: var(--color-text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  max-width: 170px;
}

.select.set select { background: var(--primary); color: var(--primary-foreground); }

.select::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 6.5px;
  height: 6.5px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  color: var(--muted-foreground);
  pointer-events: none;
}

.select.set::after { color: var(--primary-foreground); }

.toggle-chip { user-select: none; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- cards & grouped lists ---------- */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px 6px;
}

.card-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; flex: none; }
.card-head .card-sub { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }

.group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 26px 6px 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.group-title:first-child { margin-top: 8px; }
.group-title .count { font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.group-title .more, .more {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-strong);
  cursor: pointer;
}

.rows { overflow: hidden; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--border);
}

@media (hover: hover) { .row:hover { background: var(--fill-3); } }
.row:active { background: var(--fill-2); }

/* ---------- pills（ソフトバッジ）と badge（dot+太字 / Horizonテーブル式） ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.sm { height: 20px; padding: 0 8px; font-size: 10.5px; }

.st-未着手 { background: var(--st-todo-bg); color: var(--st-todo); }
.st-進行中 { background: var(--st-doing-bg); color: var(--st-doing); }
.st-要確認 { background: var(--st-confirm-bg); color: var(--st-confirm); }
.st-完了 { background: var(--st-done-bg); color: var(--st-done); }
.st-保留 { background: var(--st-hold-bg); color: var(--st-hold); }
.pill.risk { background: var(--risk-bg); color: var(--risk); }
.pill.cat { background: var(--fill-2); color: var(--subtle-foreground); }
.pill.overdue-pill { background: var(--risk-bg); color: var(--risk); }
.pill.duesoon-pill { background: var(--st-confirm-bg); color: var(--st-confirm); }

/* 期限の視覚強調（逾期=赤 / まもなく=橙） */
.period.overdue, .tt-due.overdue { color: var(--risk); font-weight: 700; }
.period.due-soon, .tt-due.due-soon { color: var(--st-confirm); font-weight: 700; }
.tt-row.overdue-row { box-shadow: inset 3px 0 0 var(--risk); }

/* 一覧行のミニ進捗バー */
.mini-prog {
  display: inline-block;
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-2);
  overflow: hidden;
  flex: none;
}
.mini-prog i { display: block; height: 100%; border-radius: 3px; background: var(--primary); transition: width 350ms var(--ease-standard); }
.right-meta .pct-num { min-width: 34px; text-align: right; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
}

.badge i { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.badge.st-未着手 { background: none; color: var(--foreground); }
.badge.st-未着手 i { background: var(--bar-todo); }
.badge.st-進行中 { background: none; color: var(--foreground); }
.badge.st-進行中 i { background: var(--bar-doing); }
.badge.st-要確認 { background: none; color: var(--foreground); }
.badge.st-要確認 i { background: var(--bar-confirm); }
.badge.st-完了 { background: none; color: var(--foreground); }
.badge.st-完了 i { background: var(--bar-done); }
.badge.st-保留 { background: none; color: var(--foreground); }
.badge.st-保留 i { background: var(--bar-hold); }
.badge.risk { color: var(--foreground); }
.badge.risk i { background: var(--destructive); }
.badge.plain { color: var(--subtle-foreground); font-weight: 600; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sd-未着手 { background: var(--bar-todo); }
.sd-進行中 { background: var(--bar-doing); }
.sd-要確認 { background: var(--bar-confirm); }
.sd-完了 { background: var(--bar-done); }
.sd-保留 { background: var(--bar-hold); }

.risk-text { color: var(--risk); }

/* ---------- progress ---------- */
.progress { display: inline-flex; align-items: center; gap: 9px; min-width: 0; width: 100%; }

.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
  min-width: 40px;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.progress-num { font-size: 12px; font-weight: 700; color: var(--foreground); flex: none; }

/* ============================================================
   マイページ
   ============================================================ */
.mypage { display: grid; gap: 18px; }

.mp-row1 {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  align-items: stretch;
}

/* profile card */
.profile-card { position: relative; overflow: hidden; padding-bottom: 20px; }

.pc-banner {
  height: 92px;
  margin: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--secondary), var(--accent) 55%, var(--primary));
}

.pc-avatar {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
}

.pc-avatar .avatar {
  box-shadow: 0 0 0 4px var(--card);
  font-size: 28px;
}

.pc-body { text-align: center; padding: 38px 20px 0; }
.pc-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.pc-role { font-size: 13px; color: var(--subtle-foreground); margin-top: 2px; }

.pc-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pc-mail { font-size: 12px; color: var(--muted-foreground); }

.pc-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--subtle-foreground);
}

.pc-stats span { display: grid; gap: 0; justify-items: center; }
.pc-stats b { font-size: 19px; font-weight: 700; color: var(--foreground); letter-spacing: -0.02em; }

/* stat cards */
.mp-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  text-align: left;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  position: relative;
}

.stat-card:active { transform: scale(0.98); }

.icon-tile {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fill-3);
  display: grid;
  place-items: center;
  flex: none;
  color: var(--primary-strong);
}


.icon-tile svg { width: 26px; height: 26px; }

.sc-text { display: grid; gap: 1px; min-width: 0; }
.sc-label { font-size: 12.5px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: var(--foreground); line-height: 1.2; }
.sc-sub {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--fill-3);
  padding: 2px 8px;
  border-radius: 999px;
}

/* layout: 2列フロー（左=ToDo+私のタスク / 右=カレンダー+動態+操作） */
.mp-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.mp-col { display: grid; gap: 18px; min-width: 0; }

/* grid item の min-width:auto による横はみ出し防止 */
.mp-row1 > *, .mp-body > *, .mp-col > * { min-width: 0; }

/* 勤務状態セレクター */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 8px 0 11px;
  border-radius: 999px;
  background: var(--fill-3);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

.status-pill:hover { background: var(--fill-2); }
.status-pill .status-dot-sm { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.status-pill select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--foreground);
  cursor: pointer;
  padding: 0 16px 0 0;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}

.sw-出社 { background: var(--success); }
.sw-在宅 { background: var(--primary); }
.sw-リモート { background: var(--secondary); }
.sw-外出 { background: var(--warning); }
.sw-出張 { background: var(--warning); }
.sw-休暇 { background: var(--muted-foreground); }
.mp-block { padding-bottom: 14px; }
.mp-filter { padding: 10px 22px 4px; }
.mp-filter .chip { background: var(--fill-3); box-shadow: none; }
.mp-filter .chip.on { background: var(--primary); }

/* ---------- task table ---------- */
.tt { padding: 6px 8px 2px; }

.tt-head, .tt-row {
  display: grid;
  /* 列構成はJS側が --ttc で指定（番号/タスク/[プロジェクト]/[担当者]/優先度/期間/状態/進捗） */
  grid-template-columns: var(--ttc, minmax(0, 2.4fr) minmax(0, 1.3fr) 52px 118px 88px minmax(96px, 1.2fr));
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
}

/* 段階の区切り行（行と同じグリッドで各列に整列） */
.tt-stage {
  display: grid;
  grid-template-columns: var(--ttc);
  gap: 8px;
  align-items: center;
  padding: 14px 14px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.tt-stage-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tt-stage-period { text-align: right; white-space: nowrap; font-size: 11.5px; color: var(--color-text-tertiary); }
.tt-stage-name { font-size: 12.5px; font-weight: 700; color: var(--primary-strong); }
.tt-stage .count { font-size: 11.5px; color: var(--subtle-foreground); }

.tt-id { font-size: 12px; font-weight: 600; color: var(--subtle-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-as { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.tt-as-name { font-size: 12.5px; font-weight: 500; color: var(--subtle-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tt-head {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--table-header);
  border-bottom: 1px solid var(--border);
  padding-top: 6px;
  padding-bottom: 8px;
}

.tt-row {
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

@media (hover: hover) { .tt-row:hover { background: var(--fill-3); } }
.tt-row:active { background: var(--fill-2); }

.tt-name { font-size: 13.5px; font-weight: 700; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-pj { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--subtle-foreground); overflow: hidden; white-space: nowrap; }
.tt-due { font-size: 12.5px; font-weight: 600; color: var(--subtle-foreground); }
.tt-more { padding: 10px 22px 8px; font-size: 12.5px; color: var(--subtle-foreground); }

/* ---------- calendar ---------- */
.cal { padding: 6px 16px 14px; }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 10px;
}

.cal-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.cal-nav { display: flex; gap: 2px; align-items: center; }
/* フラット：カレンダーの操作ボタンは透明にせず実色で */
.cal-nav .icon-btn.sm { color: var(--foreground); background: var(--fill-2); font-size: 8px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  padding: 4px 0 6px;
}

.cal-dow.wk { color: var(--label-4); }

.cal-day {
  position: relative;
  aspect-ratio: 1 / 0.92;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--subtle-foreground);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.cal-day.out { pointer-events: none; }
@media (hover: hover) { .cal-day:not(.out):hover { background: var(--fill-3); } }
.cal-day.has-ev { color: var(--foreground); font-weight: 700; }
.cal-day.sel { background: var(--primary-soft); color: var(--primary-strong); }
.cal-day.today { background: var(--primary); color: var(--primary-foreground); }
.cal-day.today .cal-dots i { background: var(--primary-foreground) !important; }

.cal-dots { display: flex; gap: 3px; height: 5px; }
.cal-dots i, .cal-legend i, .cal-event > i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.ev-task { background: var(--ev-task); }
.ev-deadline { background: var(--ev-deadline); }
.ev-meeting { background: var(--ev-meeting); }
.ev-reminder { background: var(--ev-reminder); }

.cal-legend { margin-left: auto; display: flex; gap: 12px; font-size: 11px; color: var(--subtle-foreground); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 7px; height: 7px; }

.cal-events { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 2px; }
.cal-ev-date { display: flex; align-items: center; font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.cal-ev-date .num { color: var(--muted-foreground); font-weight: 600; margin-left: 6px; }
.cal-ev-date .more { margin-left: auto; }
.cal-ev-empty { font-size: 12.5px; color: var(--muted-foreground); padding: 4px 0; }

.cal-event {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--foreground);
  transition: background var(--t-fast) var(--ease-out);
}

button.cal-event { cursor: pointer; }
button.cal-event:hover { background: var(--fill-3); }
.cal-event > i { width: 8px; height: 8px; flex: none; }
.cal-event .ce-title { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal-event .ce-time { font-size: 11.5px; color: var(--muted-foreground); flex: none; }

/* ---------- todo list ---------- */
.todo-list { padding: 8px 12px 6px; display: grid; gap: 2px; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

@media (hover: hover) { .todo-item:hover { background: var(--fill-3); } }

.todo-text { display: grid; gap: 1px; min-width: 0; flex: 1; }
.todo-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.todo-meta { font-size: 11.5px; color: var(--subtle-foreground); }
.todo-link { font-size: 11px; font-weight: 700; color: var(--primary-strong); background: var(--primary-soft); padding: 3px 9px; border-radius: 999px; flex: none; }
.todo-item.done .todo-title { color: var(--muted-foreground); text-decoration: line-through; }
.todo-item.done .todo-link { opacity: 0.5; }

/* ---------- activity ---------- */
#mp-activity { padding: 8px 14px 6px; display: grid; gap: 2px; }

.act-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 8px;
  border-radius: 12px;
  transition: background var(--t-fast) var(--ease-out);
}

.act-item[data-act-task] { cursor: pointer; }
@media (hover: hover) { .act-item[data-act-task]:hover { background: var(--fill-3); } }

.act-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.act-icon svg { width: 16px; height: 16px; }
.act-text { font-size: 12.5px; font-weight: 500; line-height: 1.5; display: grid; gap: 1px; }
.act-time { font-size: 11px; color: var(--muted-foreground); }

/* ---------- quick actions ---------- */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 18px 8px;
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px 12px;
  border-radius: 14px;
  background: var(--fill-3);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--subtle-foreground);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.qa-btn svg { width: 21px; height: 21px; color: var(--primary-strong); }
.qa-btn:active { transform: scale(0.96); }
.qa-btn.primary { background: var(--primary); color: var(--primary-foreground); }
.qa-btn.primary svg { color: var(--primary-foreground); }
@media (hover: hover) {
  .qa-btn:not(.primary):hover { background: var(--fill-2); color: var(--foreground); }
  .qa-btn.primary:hover { filter: brightness(1.08); }
}

/* ============================================================
   今日ビュー（チーム）
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
}

.stat {
  position: relative;
  padding: 16px 18px 14px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}

@media (hover: hover) { .stat:hover { background: var(--fill-3); } }

.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: var(--border);
}

.stat .n {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat .l { font-size: 12px; font-weight: 500; color: var(--muted-foreground); margin-top: 1px; }
.stat.accent .n { color: var(--primary-strong); }
.stat.warn .n { color: var(--st-confirm); }
.stat.danger .n { color: var(--risk); }
.stat.ok .n { color: var(--st-done); }

.task-line { gap: 12px; }
.task-line .t { min-width: 0; flex: 1; }

.task-line .name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-line .name.done { color: var(--muted-foreground); text-decoration: line-through; }

.task-line .meta {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--subtle-foreground);
  white-space: nowrap;
  overflow: hidden;
}

.task-line .meta .pj { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.task-line .right-meta { display: flex; align-items: center; gap: 10px; flex: none; }
.task-line .period { font-size: 12px; font-weight: 500; color: var(--subtle-foreground); font-variant-numeric: tabular-nums; }

.member-row .bar-mini {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
  max-width: 220px;
}

.member-row .bar-mini i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 350ms var(--ease-standard); }
.member-row .nums { font-size: 12px; color: var(--subtle-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* swipe-to-complete (touch) */
.row-swipe { position: relative; }

.swipe-under {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 20px;
  background: var(--success);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
}

.swipe-under svg { width: 18px; height: 18px; }

.row-swipe .row {
  position: relative;
  background: var(--card);
  transition: transform 0.22s var(--ease-out);
}

.row-swipe.dragging .row { transition: none; }

.row-swipe + .row-swipe .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--border);
}

/* checkbox */
.checkbox {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--label-4);
  display: grid;
  place-items: center;
  flex: none;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}

.checkbox::after { content: ""; position: absolute; inset: -10px; }

.checkbox svg {
  width: 13px;
  height: 13px;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.checkbox.on { background: var(--success); border-color: var(--success); }
.checkbox.on svg { opacity: 1; transform: scale(1); }
.checkbox.pop { animation: pop 0.28s var(--ease-out); }

@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ============================================================
   gantt
   ============================================================ */
.gantt-shell { padding: 4px 28px 24px; }

.gantt-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100dvh - var(--topbar-h) - 140px);
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overscroll-behavior: contain;
}

/* ---- 期間セレクター ---- */
.gantt-range {
  display: flex;
  align-items: center;
  gap: 8px;
  row-gap: 6px;
  flex-wrap: wrap;   /* 幅が足りないときは折り返す（ボタン見切れ防止） */
  min-width: 0;
}

.grange-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--fill-2);   /* フラット：浮かせず実色（ダークでも視認可能） */
  border-radius: 999px;
  padding: 2px;
}

.grange-nav .icon-btn { width: 36px; height: 36px; color: var(--foreground); }
.grange-nav .icon-btn svg { width: 16px; height: 16px; }

.grange-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--subtle-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
  min-width: 152px;
  text-align: center;
}

.grange-today {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);   /* フラット：色付き実色でボタンだと分かる */
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-strong);
}

.gseg {
  display: inline-flex;
  background: var(--fill-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.gseg button {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--subtle-foreground);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.gseg button.on { background: var(--card); color: var(--primary-strong); }
@media (hover: hover) { .gseg button:not(.on):hover { color: var(--foreground); } }

.gantt {
  --leftw: 300px;
  --colw: 34px;
  position: relative;
  width: max-content;
  min-width: 100%;
}

.g-row {
  display: grid;
  grid-template-columns: var(--leftw) repeat(var(--days, 91), var(--colw));
}

.g-months { position: sticky; top: 0; z-index: calc(var(--z-sticky) + 2); }
.g-days { position: sticky; top: 40px; z-index: calc(var(--z-sticky) + 2); }

.g-months > div, .g-days > div {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .g-months > div, .g-days > div { background: var(--card); }
}

.g-corner {
  position: sticky;
  left: 0;
  z-index: calc(var(--z-sticky) + 3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--subtle-foreground);
  box-shadow: inset -1px 0 0 var(--grid-line-strong);
}

.g-month {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: inset 1px 0 0 var(--grid-line-strong), inset 0 -1px 0 var(--border);
}

.g-day {
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 9.5px;
  line-height: 1.15;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  box-shadow: inset 1px 0 0 var(--grid-line), inset 0 -1px 0 var(--border);
}

.g-day b { font-size: 11.5px; font-weight: 700; color: var(--foreground); }
.g-day.wknd b { color: var(--muted-foreground); }
.g-day.wknd { background: var(--weekend-tint); }

/* 今日セル＝マーカー */
.g-day.cur {
  background: var(--today-col);
  box-shadow: inset 0 -3px 0 var(--primary), inset 1px 0 0 var(--grid-line), inset 0 -1px 0 var(--border);
}

.g-day.cur b, .g-day.cur span { color: var(--primary-strong); }

.g-day.m-first {
  box-shadow: inset 1.5px 0 0 var(--grid-line-strong), inset 0 -1px 0 var(--border);
}

.g-day.cur.m-first {
  box-shadow: inset 0 -3px 0 var(--primary), inset 1.5px 0 0 var(--grid-line-strong), inset 0 -1px 0 var(--border);
}

.g-days .g-corner { font-weight: 500; font-size: 11px; color: var(--muted-foreground); }

/* group header row */
.g-group {
  position: sticky;
  top: 78px;
  z-index: var(--z-sticky);
  cursor: pointer;
}

.g-group > div { background: var(--background); }

.g-group .g-left {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 18px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: inset -1px 0 0 var(--grid-line-strong), inset 0 -1px 0 var(--border);
}

.g-group .chev {
  width: 14px;
  height: 14px;
  color: var(--muted-foreground);
  transition: transform var(--t-fast) var(--ease-out);
  flex: none;
}

.g-group.closed .chev { transform: rotate(-90deg); }
.g-group .count { font-size: 11.5px; font-weight: 600; color: var(--muted-foreground); }
.g-group .gp { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--subtle-foreground); font-variant-numeric: tabular-nums; }

.g-group .g-track {
  grid-column: 2 / -1;
  position: relative;
  box-shadow: inset 0 -1px 0 var(--border);
}

.g-rollup {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
  opacity: 0.4;
}

.g-rollup i { display: block; height: 100%; border-radius: 999px; background: currentColor; }

/* task row */
.g-task { min-height: 46px; }

.g-task .g-left {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 32px;
  cursor: pointer;
  box-shadow: inset -1px 0 0 var(--grid-line-strong), inset 0 -1px 0 var(--border);
  transition: background var(--t-fast) var(--ease-out);
}

@media (hover: hover) { .g-task .g-left:hover { background: var(--fill-3); } }

.g-task .t { min-width: 0; flex: 1; }

.g-task .name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.g-task .sub {
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--subtle-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.g-task .who { flex: none; display: inline-flex; align-items: center; gap: 5px; }
.g-task .who .avatar { width: 22px; height: 22px; font-size: 9px; }

.g-task .g-track {
  grid-column: 2 / -1;
  position: relative;
  box-shadow: inset 0 -1px 0 var(--border);
  background:
    repeating-linear-gradient(to right,
      transparent 0,
      transparent calc(var(--colw) - 1px),
      var(--grid-line) calc(var(--colw) - 1px),
      var(--grid-line) var(--colw));
}

.bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  touch-action: pan-x pan-y;
  transition: box-shadow var(--t-fast) var(--ease-out);
}

.bar::after { content: ""; position: absolute; inset: -10px 0; }

.bar .fillbar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  min-width: 8px;
}

.bar .pct {
  position: relative;
  margin-left: auto;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bar.b-未着手 { background: var(--st-todo-bg); }
.bar.b-未着手 .fillbar { background: var(--bar-todo); }
.bar.b-未着手 .pct { color: var(--st-todo); }
.bar.b-進行中 { background: var(--st-doing-bg); }
.bar.b-進行中 .fillbar { background: var(--bar-doing); }
.bar.b-進行中 .pct { color: var(--st-doing); }
.bar.b-要確認 { background: var(--st-confirm-bg); }
.bar.b-要確認 .fillbar { background: var(--bar-confirm); }
.bar.b-要確認 .pct { color: var(--st-confirm); }
.bar.b-完了 { background: var(--st-done-bg); }
.bar.b-完了 .fillbar { background: var(--bar-done); }
.bar.b-完了 .pct { color: var(--st-done); }
.bar.b-保留 { background: var(--st-hold-bg); }
.bar.b-保留 .fillbar { background: var(--bar-hold); }
.bar.b-保留 .pct { color: var(--st-hold); }

@media (hover: hover) {
  .bar:hover { filter: brightness(0.97); }
}

.bar .handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 11px;
  cursor: ew-resize;
  z-index: 2;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-out);
}

.bar .handle::after {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}

.bar .handle.s { left: 1px; }
.bar .handle.e { right: 1px; }

@media (hover: hover) { .bar:hover .handle { opacity: 1; } }

.bar.dragging {
  z-index: 5;
  cursor: grabbing;
}

/* ウィンドウ端で切れている課題は角を立てて継続を示す */
.bar.clip-s { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.bar.clip-e { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

.bar-ghost {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 26px;
  border-radius: 999px;
  border: 1.5px dashed var(--muted-foreground);
  opacity: 0.6;
  pointer-events: none;
}

/* today line + cursor line */
.g-today-line, .g-cursor-line {
  position: absolute;
  top: 78px;
  bottom: 0;
  width: 2px;
  pointer-events: none;
  z-index: calc(var(--z-sticky) - 1);
}

.g-today-line { background: var(--primary); opacity: 0.8; }
.g-cursor-line { width: 1px; background: var(--primary); opacity: 0.45; }

.drag-tip {
  position: fixed;
  z-index: var(--z-tip);
  background: var(--foreground);
  color: var(--background);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 12px;
  border-radius: 10px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-pop);
}

/* ============================================================
   資料庫
   ============================================================ */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.lib-card {
  position: relative;
  display: flex;
  gap: 13px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.lib-card:active { transform: scale(0.98); }

.lib-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.lib-icon svg { width: 19px; height: 19px; }

.lib-card .t { min-width: 0; flex: 1; }
.lib-card .name { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.lib-card .note {
  margin-top: 3px;
  font-size: 12px;
  color: var(--subtle-foreground);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-card .foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.lib-card .refs { color: var(--primary-strong); font-weight: 600; }

.lib-card .del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}

.lib-card .del svg { width: 13px; height: 13px; }
.lib-card .del:hover { background: var(--risk-bg); color: var(--risk); }

@media (hover: hover) {
  .lib-card .del { opacity: 0; }
  .lib-card:hover .del, .lib-card .del:focus-visible { opacity: 1; }
}

/* ============================================================
   detail panel / sheet
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 55, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid) var(--ease-out);
  z-index: var(--z-scrim);
}

.scrim.show { opacity: 1; pointer-events: auto; }

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--card);
  z-index: var(--z-panel);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.4s var(--ease-sheet), visibility 0s 0.4s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}

.panel.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.4s var(--ease-sheet);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 18px 10px;
  flex: none;
}

.panel-head .tid { font-size: 12px; font-weight: 700; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.panel-head .grabber { display: none; }
.panel-head .nav-arrows { margin-left: auto; display: flex; gap: 2px; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 22px 28px;
  overscroll-behavior: contain;
}

.panel-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 14px;
}

/* segmented control */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--fill-3);
  border-radius: 12px;
  padding: 3px;
  height: 38px;
  margin-bottom: 16px;
}

.seg .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--n, 5));
  height: calc(100% - 6px);
  background: var(--card);
  border-radius: 9px;
  transition: transform var(--t-mid) var(--ease-sheet);
}


.seg button {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  border-radius: 9px;
}

.seg button.on { font-weight: 700; color: var(--foreground); }

/* progress slider */
.prog-row { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }

.prog-row .pv {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: right;
}

input[type="range"].slider {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  background: transparent;
  cursor: pointer;
}

input[type="range"].slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--p, 0%), var(--muted) var(--p, 0%));
}

input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(112, 144, 176, 0.28);
}

input[type="range"].slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

input[type="range"].slider::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}

input[type="range"].slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(112, 144, 176, 0.28);
}

/* meta grid */
.meta-grid {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0 14px;
  background: var(--fill-3);
  border-radius: 14px;
  padding: 8px 16px;
  margin-bottom: 18px;
}

.meta-grid > div { display: contents; }

.meta-grid dt { font-size: 12.5px; font-weight: 500; color: var(--muted-foreground); padding: 8px 0; }

.meta-grid dd {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.meta-grid select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: var(--fill-2);
  border-radius: 9px;
  height: 30px;
  padding: 0 26px 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}


.detail-sec { margin-bottom: 16px; }

.detail-sec h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 5px;
}

.detail-sec p { font-size: 13.5px; line-height: 1.7; max-width: 72ch; }
.detail-sec ul { padding-left: 18px; font-size: 13px; line-height: 1.65; display: grid; gap: 4px; }

.res-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--foreground);
}

.res-row + .res-row { box-shadow: inset 0 1px 0 var(--border); }
.res-line { display: flex; align-items: center; gap: 4px; }
.res-line .res-row { flex: 1; min-width: 0; }
.res-line + .res-line { box-shadow: inset 0 1px 0 var(--border); }
.res-line .icon-btn { opacity: 0; transition: opacity .15s ease; }
.res-line:hover .icon-btn, .res-line .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .res-line .icon-btn { opacity: 1; } }
.link-add { margin-top: 8px; display: inline-flex; }
.res-row:hover { text-decoration: none; }
.res-row .lib-icon { width: 32px; height: 32px; }
.res-row .lib-icon svg { width: 15px; height: 15px; }
.res-row .rn { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .rd { font-size: 11.5px; color: var(--subtle-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .open-ind { margin-left: auto; color: var(--label-4); flex: none; }
.res-row .open-ind svg { width: 14px; height: 14px; }

.panel-foot {
  flex: none;
  padding: 12px 22px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  box-shadow: 0 -1px 0 var(--border);
  background: var(--card);
}

.panel-foot .btn { flex: 1; min-height: 46px; }

/* ============================================================
   modal（作成 / 資料 / 追加 / palette 共通）
   ============================================================ */
.modal {
  position: fixed;
  z-index: var(--z-modal);
  left: 50%;
  top: 11vh;
  transform: translateX(-50%) translateY(6px) scale(0.98);
  width: min(580px, calc(100vw - 28px));
  max-height: 78dvh;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  /* 内部のsticky footer等が下端まで届いても角丸を保つ */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--motion-normal) var(--ease-standard), transform var(--motion-normal) var(--ease-emphasized), visibility 0s var(--motion-normal);
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  transition: opacity var(--motion-normal) var(--ease-standard), transform var(--motion-normal) var(--ease-emphasized);
}

.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 10px; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--subtle-foreground);
  margin-bottom: 6px;
}

.field input[type="text"], .field input[type="url"], .field input[type="password"],
.field input[type="email"], .field input[type="date"], .field textarea, .field select {
  width: 100%;
  border: none;
  background: var(--input);
  border-radius: var(--r-control);
  min-height: 42px;
  padding: 10px 13px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--foreground);
  outline: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}

.field input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.5; cursor: pointer; }

.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.field input:focus, .field textarea:focus, .field select:focus {
  box-shadow: inset 0 0 0 1.5px var(--ring);
  background: var(--card);
}

/* 詳細パネルの日付入力 */
.meta-grid .dates { gap: 6px; }

.meta-grid input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: var(--fill-2);
  border-radius: 9px;
  height: 30px;
  padding: 0 9px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}


.field textarea { resize: vertical; min-height: 76px; line-height: 1.6; }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; }

/* resource upload */
.dropzone {
  border: 1.5px dashed var(--separator-strong);
  border-radius: 14px;
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}

.dropzone:hover, .dropzone.over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* color picker */
.color-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 2px 0; }

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.color-dot:active { transform: scale(0.9); }
.color-dot.sel { box-shadow: 0 0 0 2px var(--card), 0 0 0 4.5px var(--primary); }

/* palette */
.palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  box-shadow: inset 0 -1px 0 var(--border);
}

.palette-input svg { width: 18px; height: 18px; color: var(--muted-foreground); flex: none; }

.palette-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
}

.palette-input input::placeholder { color: var(--muted-foreground); }

.palette-list { overflow-y: auto; padding: 8px; }

.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
}

.palette-item.sel { background: var(--primary-soft); }
.palette-item .pi-name { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.palette-item .pi-sub { font-size: 11.5px; color: var(--muted-foreground); flex: none; }
.palette-empty { padding: 28px; text-align: center; color: var(--muted-foreground); font-size: 13px; }

/* ---------- user menu ---------- */
.user-menu {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top));
  right: 24px;
  width: 248px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: calc(var(--z-modal) - 5);
}

.um-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 13px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.um-name { font-weight: 700; font-size: 14px; }
.um-role { font-size: 11.5px; color: var(--muted-foreground); }

.um-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 10px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  transition: background var(--t-fast) var(--ease-out);
}

.um-item svg { width: 17px; height: 17px; color: var(--subtle-foreground); flex: none; }
.um-item:hover { background: var(--fill-3); }
.um-item.danger { color: var(--destructive-text); }
.um-item.danger svg { color: var(--destructive-text); }

/* ---------- login ---------- */
.login {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-toast) + 10);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  padding: 20px;
  overflow-y: auto;
}

.login[hidden] { display: none; }

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(640px 420px at 82% -8%, rgba(0, 122, 255, 0.10), transparent 62%),
    radial-gradient(520px 380px at -8% 104%, rgba(120, 120, 128, 0.08), transparent 62%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-pop);
  padding: 30px 30px 24px;
  display: grid;
  gap: 13px;
}

.login-form { display: grid; gap: 13px; }
.login-form[hidden] { display: none; }
.login-error[hidden] { display: none; }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.login-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.login-sub { font-size: 13px; color: var(--subtle-foreground); margin-top: -8px; }
.login-btn { min-height: 46px; margin-top: 4px; }
.login-note { font-size: 11.5px; color: var(--muted-foreground); text-align: center; }

.login-error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--destructive-text);
  background: var(--risk-bg);
  border-radius: 10px;
  padding: 9px 12px;
  margin: -2px 0 2px;
}

.login-switch { font-size: 12.5px; color: var(--subtle-foreground); text-align: center; margin-top: 2px; }
.login-switch button { color: var(--primary-strong); font-weight: 700; font-size: 12.5px; }
.login-switch button:hover { text-decoration: underline; }
.login-card h2 { margin-top: 4px; }

body.logged-out .shell,
body.logged-out .tabbar,
body.logged-out .fab { display: none !important; }

/* ============================================================
   プロジェクト詳細
   ============================================================ */
.pj-detail { display: grid; gap: 18px; }

.pj-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.pj-head-main { min-width: 0; flex: 1; }
.pj-name { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.dot.lg { width: 14px; height: 14px; }
.pj-desc { margin-top: 6px; font-size: 14px; color: var(--subtle-foreground); line-height: 1.6; max-width: 72ch; }
.pj-head-actions { display: flex; gap: 8px; align-items: center; flex: none; }

.pj-stats { grid-template-columns: repeat(5, 1fr); }

.pj-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.pj-row > * { min-width: 0; }

.pj-info { padding: 6px 22px 16px; display: grid; gap: 2px; }
.pj-info-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; padding: 9px 0; }
.pj-info-row + .pj-info-row { box-shadow: inset 0 1px 0 var(--border); }
.pj-info-row dt { font-size: 12.5px; color: var(--muted-foreground); font-weight: 600; }
.pj-info-row dd { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.pj-members { gap: 8px !important; }
.pj-member { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; background: var(--fill-3); padding: 3px 10px 3px 4px; border-radius: 999px; }

.link-btn { color: var(--primary-strong); font-weight: 600; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.pj-product { padding: 6px 22px 18px; }
.pj-product-name { font-size: 15px; font-weight: 700; }
.pj-product-info { margin-top: 6px; font-size: 13.5px; color: var(--subtle-foreground); line-height: 1.65; }
.pj-product-info.muted { color: var(--muted-foreground); }
.pj-product-link { margin-top: 12px; }

.pj-reslist { padding: 8px 18px 4px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pj-reslist .lib-card { box-shadow: none; background: var(--fill-3); }
.pj-reslist .lib-card:active { transform: scale(0.98); }

/* メンバーピッカー（プロジェクトフォーム） */
.member-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  background: var(--fill-2);
  color: var(--subtle-foreground);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.member-chip.on { background: var(--primary-soft); color: var(--primary-strong); box-shadow: inset 0 0 0 1px var(--primary); }
.member-chip:active { transform: scale(0.97); }

/* ---------- danger buttons / icon-only ---------- */
.btn.danger { color: var(--destructive-text); }
.btn.danger:hover { background: var(--risk-bg); }
.btn.icon-only { flex: 0 0 auto; padding: 0; width: 46px; }
.btn.icon-only svg { width: 18px; height: 18px; }
.icon-btn.danger { color: var(--destructive-text); }
.icon-btn.danger:hover { background: var(--risk-bg); color: var(--destructive-text); }

/* ============================================================
   資料庫 — OpenListスタイルのファイルエクスプローラ
   ============================================================ */
#view-library .view-pad { max-width: 1180px; }

/* パンくず */
.lx-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 2px 6px 12px; font-size: 14px; min-width: 0; }
.lx-crumb-link, .lx-crumb-cur { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-crumb-link { color: var(--subtle-foreground); cursor: pointer; transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out); }
.lx-crumb-link:hover { background: var(--fill-2); color: var(--foreground); }
.lx-crumb-cur { font-weight: 700; color: var(--foreground); }
.lx-sep { color: var(--label-4); }

/* ツールバー */
.lx-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px 12px; }
.lx-search { position: relative; display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; height: 36px; min-width: 200px; flex: 0 1 240px; color: var(--label-2); }
.lx-search input { border: none; outline: none; background: transparent; font: inherit; font-size: 13px; color: var(--foreground); width: 100%; }
.lx-search input::-webkit-search-cancel-button { display: none; }
.lx-clear { position: absolute; right: 6px; font-size: 15px; color: var(--label-3); padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.lx-clear:hover { background: var(--fill-2); color: var(--foreground); }
.lx-sel { height: 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font: inherit; font-size: 13px; color: var(--foreground); padding: 0 8px; max-width: 170px; }
.lx-count { font-size: 12.5px; color: var(--subtle-foreground); padding: 0 2px; }
.lx-spacer { flex: 1; }
.lx-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-strong); cursor: pointer; transition: filter var(--t-fast) var(--ease-out); }
.lx-iconbtn:hover { filter: brightness(0.95); }
.lx-iconbtn.sm { width: 30px; height: 30px; background: transparent; color: var(--label-3); border-radius: 8px; }
.lx-iconbtn.sm:hover { background: var(--fill-2); color: var(--foreground); }
.lx-add { min-height: 36px; padding: 0 16px; font-size: 13px; }
.lx-viewwrap { position: relative; }

/* メニュー（表示切替・行操作 共通） */
.lx-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 168px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 5px; }
.lx-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--foreground); cursor: pointer; text-align: left; }
.lx-menu-item:hover { background: var(--fill-2); }
.lx-menu-item.on { color: var(--primary-strong); font-weight: 700; }
.lx-menu-item.danger { color: var(--destructive-text); }
.lx-menu-item svg { width: 15px; height: 15px; flex: none; }
.lx-mcheck { margin-left: auto; }

/* 白いファイルパネル（OpenList風） */
.lx-panel { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-card); padding: 6px 8px 8px; }
.lx-panel-grid { padding: 16px; }

/* リスト行 */
.lx-head, .lx-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 92px 150px 38px; gap: 8px; align-items: center; padding: 7px 10px; }
.lx-head { font-size: 12px; font-weight: 600; color: var(--table-header); border-bottom: 1px solid var(--border); padding-top: 8px; padding-bottom: 9px; }
.lx-head .lx-size, .lx-head .lx-date { text-align: right; }
.lx-row { border-radius: 10px; cursor: pointer; min-height: 46px; transition: background var(--t-fast) var(--ease-out); }
@media (hover: hover) { .lx-row:hover { background: var(--fill-3); } }
.lx-row:active { background: var(--fill-2); }
.lx-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.lx-ic { display: inline-flex; }
.lx-name { min-width: 0; display: grid; gap: 1px; }
.lx-title { font-size: 13.5px; font-weight: 600; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-sub { font-size: 11.5px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-width: 0; }
.lx-sub .lx-chip { flex: none; background: var(--fill-2); border-radius: 5px; padding: 1px 6px; font-weight: 600; color: var(--subtle-foreground); }
.lx-subtxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-refs { flex: none; color: var(--primary-strong); font-weight: 600; font-size: 11.5px; cursor: pointer; border-radius: 5px; padding: 1px 4px; }
.lx-refs:hover { background: var(--primary-soft); }
.lx-size, .lx-date { font-size: 12.5px; color: var(--subtle-foreground); text-align: right; white-space: nowrap; }
.lx-mcol { position: relative; display: flex; justify-content: flex-end; }
.lx-rowmenu { top: calc(100% + 2px); }

/* グリッド / 画像ビュー */
.lx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.lx-tile { display: grid; justify-items: center; gap: 6px; padding: 14px 8px 12px; border-radius: 12px; cursor: pointer; transition: background var(--t-fast) var(--ease-out); }
@media (hover: hover) { .lx-tile:hover { background: var(--fill-3); } }
.lx-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.lx-tile-ic { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; }
.lx-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.lx-tile-name { font-size: 12.5px; font-weight: 600; color: var(--foreground); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-tile-sub { font-size: 11px; color: var(--label-2); }

/* 状態表示 */
.lx-empty { display: grid; justify-items: center; gap: 12px; padding: 46px 20px 50px; color: var(--label-2); font-size: 13.5px; }

/* レスポンシブ */
@media (max-width: 1023px) {
  .lx-head, .lx-row { grid-template-columns: 32px minmax(0, 1fr) 84px 38px; }
  .lx-date, .lx-head .lx-date { display: none; }
}
@media (max-width: 640px) {
  .lx-head, .lx-row { grid-template-columns: 30px minmax(0, 1fr) 34px; padding: 7px 6px; }
  .lx-size, .lx-head .lx-size { display: none; }
  .lx-search { flex: 1 1 100%; }
  .lx-sel { max-width: 46%; flex: 1; }
  .lx-add { flex: 1; }
  .lx-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* ============================================================
   課題ページ（専用ビュー）＋ 作業記録（ブログ）
   ============================================================ */
.task-page { max-width: 1280px; margin: 0 auto; }
.task-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.task-top .tid { font-size: 12.5px; font-weight: 600; color: var(--subtle-foreground); }
.task-top .spacer { flex: 1; }
.task-back { padding: 0 14px; }
.task-back svg { width: 15px; height: 15px; }
.task-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 16px; line-height: 1.35; }

/* 左＝ステータス・詳細・資料 / 右＝作業記録（DOM順は main→side だが列指定で入れ替え） */
.task-cols { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.6fr); gap: 18px; align-items: start; }
.task-main, .task-side { display: grid; gap: 18px; min-width: 0; }
.task-main { grid-column: 2; grid-row: 1; }
.task-side { grid-column: 1; grid-row: 1; }
.task-meta-card { padding: 16px 20px 18px; display: grid; gap: 12px; }
.task-meta-card .meta-grid { margin: 0; }
.task-detail-body, .task-res-body { padding: 4px 20px 18px; }
.task-res-body .link-add { margin-top: 8px; }

/* --- 記録コンポーザー --- */
.log-composer { margin: 4px 20px 16px; border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--fill-3); }
.log-composer textarea {
  width: 100%; min-height: 72px; resize: vertical; border: none; background: transparent;
  font: inherit; font-size: 13.5px; line-height: 1.7; color: var(--foreground); outline: none;
}
.log-staged { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.staged-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: 12px; font-weight: 500; padding: 4px 8px 4px 10px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border); overflow: hidden; white-space: nowrap;
}
.staged-chip button { font-size: 14px; line-height: 1; color: var(--label-3); padding: 0 2px; cursor: pointer; }
.staged-chip button:hover { color: var(--risk); }
.log-linkrow { display: flex; gap: 8px; margin: 8px 0 2px; flex-wrap: wrap; }
.log-linkrow input { flex: 1; min-width: 140px; }
.log-linkrow .btn { min-height: 36px; padding: 0 14px; }
.log-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.log-actions .spacer { flex: 1; }
.log-actions .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }
.log-actions .btn svg { width: 15px; height: 15px; }

/* --- 記録タイムライン --- */
.log-list { padding: 0 20px 16px; display: grid; gap: 12px; }
.log-entry { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.log-head { display: flex; align-items: center; gap: 9px; }
.log-user { font-size: 13px; font-weight: 700; }
.log-time { font-size: 11.5px; color: var(--label-2); }
.log-ops { margin-left: auto; display: inline-flex; gap: 2px; opacity: 0.55; }
.log-entry:hover .log-ops { opacity: 1; }
.log-text { margin-top: 8px; font-size: 13.5px; line-height: 1.8; overflow-wrap: break-word; }
.log-text a { color: var(--primary-strong); text-decoration: underline; }
.log-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.log-img-wrap { display: block; max-width: 220px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.log-img { display: block; max-width: 100%; max-height: 180px; object-fit: cover; }
.log-atts { display: grid; gap: 6px; margin-top: 10px; }
.log-att {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  background: var(--fill-3); border: 1px solid var(--border); font-size: 12.5px; color: var(--foreground);
  text-decoration: none; min-width: 0;
}
.log-att svg { width: 16px; height: 16px; flex: none; color: var(--label-2); }
.la-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.la-sub { color: var(--label-2); font-size: 11.5px; flex: none; }
.la-dl { margin-left: auto; display: inline-flex; padding: 3px; border-radius: 6px; color: var(--label-2); }
.la-dl:hover { background: var(--fill-2); color: var(--foreground); }
.log-att:hover { background: var(--fill-2); }

/* --- 段階管理 --- */
.stage-row { cursor: grab; }
.stage-row:active { cursor: grabbing; }
.stage-grip { display: inline-flex; color: var(--label-4); }
.stage-grip svg { width: 15px; height: 15px; }
.stage-rename { flex: 1; min-width: 0; font: inherit; }

@media (max-width: 1200px) {
  .task-cols { grid-template-columns: 1fr; }
  .task-main, .task-side { grid-column: auto; grid-row: auto; }
}
@media (max-width: 1023px) {
  .task-title { font-size: 20px; }
  .log-img-wrap { max-width: 46%; }
}

/* ---------- 汎用モーダル内のフッター（modal-body内に配置） ---------- */
#gen-body { padding-bottom: 0; }
#gen-body .modal-foot {
  position: sticky;
  bottom: 0;
  margin: 14px -20px 0;
  padding: 14px 20px 16px;
  background: var(--card);
  box-shadow: 0 -1px 0 var(--border);
}

/* ---------- メンバー追加：初期パスワード ---------- */
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }
.pw-row .btn { flex: 0 0 auto; min-height: 40px; padding: 0 14px; }
.field-hint { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--label-2); }
.pw-done p { font-size: 13.5px; line-height: 1.7; }
.pw-show {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--fill-2);
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.8;
  user-select: all;
  -webkit-user-select: all;
}

/* ---------- 管理リスト（プロジェクト / メンバー） ---------- */
.mgr-list { display: grid; gap: 2px; padding: 2px 0; max-height: 52vh; overflow-y: auto; }

.mgr-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 12px;
  transition: background var(--t-fast) var(--ease-out);
}

.mgr-row + .mgr-row { box-shadow: inset 0 1px 0 var(--border); }
.mgr-row[data-pj-open] { cursor: pointer; }
@media (hover: hover) { .mgr-row[data-pj-open]:hover { background: var(--fill-3); } }
.mgr-row .mgr-name { font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-row .mgr-sub { margin-left: auto; font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.mgr-row .icon-btn.sm { flex: none; }
.mgr-you { font-size: 10px; font-weight: 700; color: var(--primary-strong); background: var(--primary-soft); padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.mgr-empty { padding: 28px; text-align: center; color: var(--muted-foreground); font-size: 13px; }

/* row hover actions（ToDo等） */
.row-actions { display: flex; gap: 2px; flex: none; }
.row-actions .icon-btn.sm { color: var(--muted-foreground); }
@media (hover: hover) {
  .row-actions { opacity: 0; transition: opacity var(--t-fast) var(--ease-out); }
  .todo-item:hover .row-actions, .row-actions:focus-within { opacity: 1; }
}

/* ---------- 資料の詳細 ---------- */
.res-detail { padding: 2px 0 4px; }
.rd-head { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.rd-head .lib-icon { width: 46px; height: 46px; }
.rd-titles { min-width: 0; }
.rd-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.rd-meta { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--subtle-foreground); margin-top: 2px; }
.rd-sec { margin-bottom: 13px; }
.rd-sec h4 { font-size: 12px; font-weight: 700; color: var(--muted-foreground); margin-bottom: 4px; }
.rd-sec p { font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.rd-link { color: var(--subtle-foreground); }
.rd-refs { display: grid; gap: 4px; }
.rd-ref {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--fill-3);
  color: var(--foreground);
  transition: background var(--t-fast) var(--ease-out);
}
.rd-ref:hover { background: var(--fill-2); }
.rd-foot { flex-wrap: wrap; }
.rd-foot .btn { flex: 1; min-width: 96px; }
.rd-foot .btn.danger { flex: 0 0 auto; min-width: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--foreground);
  color: var(--background);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 19px;
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid) var(--ease-out), transform var(--t-mid) var(--ease-out);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast svg { width: 15px; height: 15px; color: var(--success); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- tab bar (mobile) ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-tabbar);
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 -8px 30px rgba(112, 144, 176, 0.16);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .tabbar { background: var(--card); }
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 600;
}

.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--primary-strong); font-weight: 700; }

/* ---------- empty state ---------- */
.empty { padding: 48px 24px; text-align: center; color: var(--muted-foreground); }
.empty svg { width: 34px; height: 34px; margin-bottom: 10px; opacity: 0.6; }
.empty p { font-size: 13.5px; margin-bottom: 14px; }

/* ---------- fab (mobile) ---------- */
.fab {
  display: none;
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  place-items: center;
  z-index: var(--z-chrome);
  transition: transform var(--t-fast) var(--ease-out);
}

.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(0.92); }

/* ---------- desktop hover states ---------- */
@media (hover: hover) {
  .btn-primary:hover { filter: brightness(1.1); }
  .btn-tinted:hover { background: var(--primary-soft); filter: brightness(0.96); }
  .btn-gray:hover { background: var(--fill); }
  .chip:not(.on):hover { color: var(--foreground); background: var(--fill); }
  .select select:hover { color: var(--foreground); background: var(--fill); }
  .seg button:not(.on):hover { color: var(--foreground); }
  .lib-card:hover { box-shadow: var(--shadow-raised); transform: translateY(-2px); }
  .group-title .more:hover, .more:hover { text-decoration: underline; }
  .stat-card:hover { box-shadow: var(--shadow-raised); transform: translateY(-2px); }
  .tab:hover { color: var(--subtle-foreground); }
  .tab.active:hover { color: var(--primary-strong); }
}

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 1240px) {
  .mp-row1 { grid-template-columns: 1fr; }
  .mp-stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1023px) {
  :root { --topbar-h: 64px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tabbar { display: grid; }
  .fab { display: grid; }

  .content { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 70px); }

  .topbar {
    min-height: var(--topbar-h);
    padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  .topbar h1 { font-size: 21px; }
  .sidebar-toggle { display: none; }

  .top-capsule { padding: 0; background: transparent; box-shadow: none; gap: 0; }
  .searchbox { background: transparent; width: 38px; height: 38px; justify-content: center; padding: 0; color: var(--subtle-foreground); }
  .searchbox .label, .searchbox kbd { display: none; }
  .searchbox svg { width: 19px; height: 19px; }

  .view-pad { padding: 6px 16px 24px; }
  .toolbar { padding: 4px 16px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar .right { margin-left: 0; flex: none; }

  /* マイページ */
  .mp-row1, .mp-body { grid-template-columns: 1fr; }
  .mp-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* プロジェクト詳細 */
  .pj-row { grid-template-columns: 1fr; }
  .pj-head-actions { width: 100%; }
  .pj-head-actions .btn:not(.icon-only) { flex: 1; }
  .mypage { gap: 14px; }
  .stat-card { padding: 14px 16px; gap: 11px; }
  .sc-sub { display: none; }
  .icon-tile { width: 46px; height: 46px; }
  .icon-tile svg { width: 22px; height: 22px; }
  .sc-value { font-size: 20px; }

  /* タスクテーブル: 列を絞る */
  .tt-head, .tt-row { grid-template-columns: var(--ttc-m, minmax(0, 1.8fr) 104px minmax(86px, 1fr)); gap: 8px; padding: 10px 10px; }
  .tt .c-id, .tt .c-pj, .tt .c-as, .tt .c-pri, .tt .c-prog { display: none; }

  .stats { grid-template-columns: repeat(5, minmax(96px, 1fr)); overflow-x: auto; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }

  .gantt-shell { padding: 0 14px 10px; }
  .gantt-wrap { max-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - env(safe-area-inset-bottom) - 150px); }
  .gantt { --leftw: 150px; --colw: 26px; }
  .g-task .name { font-size: 11.5px; }
  .g-task .sub { font-size: 10px; }
  .g-task .g-left { padding-left: 14px; }
  .g-task .who { display: none; }
  .bar { height: 22px; }
  .bar .handle { display: none; }
  .bar .pct { font-size: 9.5px; padding: 0 6px; }
  .g-group { top: 64px; }
  .g-month { height: 34px; font-size: 12px; }
  .g-day { height: 30px; font-size: 8px; }
  .g-day b { font-size: 10px; }
  .g-days { top: 34px; }
  .g-today-line, .g-cursor-line { top: 64px; }

  /* detail panel → bottom sheet */
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88dvh;
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  }

  .panel.open { transform: translateY(0); }
  .panel:not(.open) { transform: translateY(105%); }

  .panel-head { flex-wrap: wrap; padding-top: 6px; }

  .panel-head .grabber {
    display: block;
    width: 100%;
    order: -1;
    padding: 6px 0 8px;
    touch-action: none;
  }

  .panel-head .grabber::after {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    border-radius: 999px;
    background: var(--label-4);
    margin: 0 auto;
  }

  .modal {
    top: auto;
    bottom: 0;
    left: 0;
    transform: translateY(8%) scale(1);
    width: 100%;
    max-height: 86dvh;
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  }

  .modal.open { transform: translateY(0) scale(1); }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }

  .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }

  .user-menu { top: calc(58px + env(safe-area-inset-top)); right: 12px; }
}

@media (max-width: 480px) {
  .page-head h2 { font-size: 19px; }
  .task-line .period { display: none; }
  .qa-grid { grid-template-columns: repeat(3, 1fr); }
  .pc-stats { gap: 18px; }
}

/* ---------- touch ergonomics ---------- */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .chip { height: 38px; }
  .select select { height: 38px; }
  .seg { height: 42px; }
  .panel-head .grabber { padding: 10px 0 12px; }
}

/* ---------- reduced motion / transparency ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .g-months > div, .g-weeks > div {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--card);
  }
  .topbar { background: var(--background); }
}

/* ============================================================
   2026-07 追加分：グループ / 並び替え / 一覧ビュー / 複数アップロード
   ============================================================ */

/* ---------- プロジェクトフォーム：意味付きカラー選択 ---------- */
.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.color-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 8px;
  border-radius: 999px;
  background: var(--fill-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--subtle-foreground);
}
.color-opt .color-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.color-opt.sel { background: var(--primary-soft); color: var(--primary-strong); box-shadow: inset 0 0 0 1.5px var(--primary); }
@media (hover: hover) { .color-opt:not(.sel):hover { background: var(--fill); } }

/* ---------- サイドバー：プロジェクトのグループ＆ドラッグ並び替え ---------- */
.pj-group { display: grid; gap: 2px; }
.pj-group + .pj-group { margin-top: 6px; }
.pj-group-head {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  text-transform: none;
  padding: 6px 14px 2px;
}
.pj-group-head.drop-into { color: var(--primary-strong); background: var(--primary-soft); border-radius: 8px; }
.pj-item { cursor: grab; }
.pj-item:active { cursor: grabbing; }
.pj-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-item.pj-dragging { opacity: 0.45; }
.pj-item.drop-above { box-shadow: inset 0 2px 0 var(--primary); }
.pj-item.drop-below { box-shadow: inset 0 -2px 0 var(--primary); }

/* ---------- ガント：グループ（分組）名チップ ---------- */
.g-grpname {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-foreground);
  background: var(--fill-2);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex: none;
}

/* ---------- 資料追加：複数URL・複数ファイル ---------- */
#rf-url-rows { display: grid; gap: 8px; }
.rf-url-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr) auto; gap: 8px; align-items: center; }
.rf-add-url { margin-top: 8px; min-height: 34px; padding: 0 14px; font-size: 12.5px; }
.rf-add-url svg { width: 14px; height: 14px; }
.rf-frm {
  width: 28px; height: 28px; flex: none;
  border-radius: 50%;
  background: var(--fill-2);
  color: var(--muted-foreground);
  font-size: 12px;
  display: grid; place-items: center;
}
@media (hover: hover) { .rf-frm:hover { background: var(--risk-bg); color: var(--destructive-text); } }
.rf-files { display: grid; gap: 4px; text-align: left; margin-bottom: 8px; }
.rf-file {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: var(--fill-2);
  font-size: 12.5px;
}
.rf-file .rf-fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rf-file .rf-fsize { color: var(--muted-foreground); flex: none; }

/* ---------- 一覧共通ヘッダー ---------- */
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- プロジェクト一覧 ---------- */
.pjov-list { padding: 4px 0; margin-bottom: 18px; }
.pjov-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
}
.pjov-row + .pjov-row { box-shadow: inset 0 1px 0 var(--border); }
@media (hover: hover) { .pjov-row:hover { background: var(--fill-3); } }
.pjov-row .dot.lg { width: 14px; height: 14px; flex: none; }
.pjov-main { flex: 1; min-width: 0; }
.pjov-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pjov-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.pjov-desc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--subtle-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pjov-meta { margin-top: 5px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted-foreground); }
.pjov-side { flex: none; width: 150px; }

/* ---------- メンバー一覧 ---------- */
.mbov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; }
.mbov-card { padding: 16px 18px 14px; }
.mbov-head { display: flex; align-items: center; gap: 12px; }
.mbov-id { flex: 1; min-width: 0; }
.mbov-name { font-size: 15px; font-weight: 700; }
.mbov-sub { font-size: 12px; color: var(--subtle-foreground); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbov-st { flex: none; }
.mbov-st i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.mbov-kpis { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 10px; }
.mbov-kpi {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--subtle-foreground);
  background: var(--fill-2);
  border-radius: 999px;
  padding: 5px 10px;
}
.mbov-kpi b { color: var(--foreground); font-weight: 700; margin-left: 2px; }
button.mbov-kpi { cursor: pointer; }
@media (hover: hover) { button.mbov-kpi:hover { background: var(--fill); } }
.mbov-kpi.is-alert { background: var(--risk-bg); color: var(--destructive-text); }
.mbov-kpi.is-alert b { color: var(--destructive-text); }
.mbov-prog { margin-left: auto; width: 130px; }
.mbov-empty { font-size: 12.5px; color: var(--muted-foreground); padding: 10px 2px; }
.mbov-more { margin-top: 8px; }
.mbov-card .tt-head, .mbov-card .tt-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 100px 72px; }
.mbov-card .c-id, .mbov-card .c-pri, .mbov-card .c-prog { display: none; }

@media (max-width: 760px) {
  .mbov-grid { grid-template-columns: 1fr; }
  .pjov-side { display: none; }
  .rf-url-row { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .rf-url-row .rf-frm { position: absolute; }
  .rf-url-row { position: relative; padding-right: 34px; }
  .rf-url-row .rf-frm { right: 0; top: 4px; }
}

/* ============================================================
   macOS Light リデザイン — セグメント・モーション・a11y
   ============================================================ */

/* ---------- 状態フィルタ＝セグメントコントロール ---------- */
.statusseg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--fill-2);
  flex: none;
}
.statusseg .chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary);
  font-weight: 600;
}
.statusseg .chip:hover { background: rgba(255, 255, 255, 0.7); color: var(--color-text-primary); }
.statusseg .chip.on {
  background: var(--color-surface);
  color: var(--color-accent-text);
  box-shadow: 0 0 0 1px rgba(60, 60, 67, 0.10), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- ページ遷移（サイドバー/トップバーは静止、コンテンツのみ） ---------- */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.content > .view.active { animation: viewIn var(--motion-page) var(--ease-standard) both; }

/* ---------- メニュー・ポップオーバーの入場 ---------- */
@keyframes popIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.user-menu:not([hidden]) { animation: popIn var(--motion-fast) var(--ease-standard) both; }
.lx-menu { animation: popIn var(--motion-fast) var(--ease-standard) both; }

/* ---------- フォーカスリング（キーボード操作の可視化） ---------- */
:where(button, [role="button"], a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.nav-item:focus-visible, .tt-row:focus-visible, .lx-row:focus-visible { outline-offset: -2px; }

/* ---------- 入力/検索の最小 40px（資料庫ツールバー含む） ---------- */
.lx-search, .lx-sel { height: 40px; }
.lx-iconbtn { width: 40px; height: 40px; }
.field input, .field select { min-height: 40px; }

/* ---------- 無効状態は不透明度だけに頼らない ---------- */
.btn:disabled, .btn[disabled] {
  background: var(--fill-2);
  color: var(--color-text-disabled);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Leantime 機能アップグレード — カンバン / 依存 / 履歴 / 状況報告 / マイToDo
   ============================================================ */

/* ---------- カンバン ---------- */
.kb-page { max-width: none; }
.kb-hint { font-size: 12px; color: var(--color-text-tertiary); }
.kb-board { display: grid; grid-template-columns: repeat(5, minmax(228px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 16px; }
.kb-col { background: var(--fill-2); border-radius: 12px; min-width: 228px; }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 13px; font-weight: 700; }
.kb-col-head .count { color: var(--color-text-tertiary); font-size: 12px; }
.kb-col-body { display: grid; gap: 8px; padding: 4px 8px 10px; min-height: 60px; border-radius: 0 0 12px 12px; transition: background var(--motion-fast) var(--ease-standard); }
.kb-col-body.over { background: var(--color-accent-soft); }
.kb-empty { color: var(--color-text-disabled); font-size: 12px; text-align: center; padding: 14px 0; }
.kb-card { background: var(--color-surface); border-radius: 10px; box-shadow: var(--shadow-card); padding: 10px 12px; cursor: grab; display: grid; gap: 7px; transition: box-shadow var(--motion-fast) var(--ease-standard), opacity var(--motion-fast) var(--ease-standard); }
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: 0.45; }
.kb-card.saving { opacity: 0.55; pointer-events: none; }
.kb-card:hover { box-shadow: var(--shadow-raised); }
.kb-title { font-size: 13px; font-weight: 650; line-height: 1.45; }
.kb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--color-text-secondary); }
.kb-pj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.kb-blocked { background: var(--risk-bg); color: var(--risk); }
.kb-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--color-text-tertiary); }
.kb-foot .kb-due { margin-left: auto; }
.kb-foot .kb-due.overdue { color: var(--risk); font-weight: 700; }
@media (max-width: 1200px) { .kb-board { grid-template-columns: repeat(5, 228px); } }

/* ---------- 依存関係 ---------- */
.dep-body { padding: 4px 20px 16px; display: grid; gap: 8px; }
.dep-blocked-banner { background: var(--risk-bg); color: var(--risk); font-size: 12.5px; font-weight: 700; border-radius: 10px; padding: 9px 12px; }
.dep-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dep-kind { flex: none; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 7px; }
.dep-kind.blk { background: var(--st-confirm-bg); color: var(--st-confirm); }
.dep-kind.blkby { background: var(--risk-bg); color: var(--risk); }
.dep-kind.rel { background: var(--fill-2); color: var(--color-text-secondary); }
.dep-open { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; text-align: left; font-size: 13px; font-weight: 600; color: var(--foreground); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.dep-open:hover { background: var(--color-surface-hover); }
.dep-open:disabled { color: var(--color-text-disabled); cursor: default; }
.dep-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-none { font-size: 13px; color: var(--color-text-tertiary); padding: 4px 0; }
.dep-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dep-add select { flex: 1; min-width: 130px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font: inherit; font-size: 12.5px; padding: 0 8px; }
.dep-add .btn { min-height: 36px; padding: 0 14px; }

/* ---------- マイToDo（課題ページ内・自分のみ） ---------- */
.mytodo-private { margin-left: auto; font-size: 11px; color: var(--color-text-tertiary); }
.mytodo-body { padding: 4px 20px 16px; display: grid; gap: 6px; }
.mytodo-line { display: flex; align-items: center; gap: 9px; min-height: 36px; }
.mytodo-line.done .mytodo-title { text-decoration: line-through; color: var(--color-text-tertiary); }
.mytodo-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mytodo-date { font-size: 11.5px; color: var(--color-text-tertiary); }
.checkbox.sm { width: 20px; height: 20px; }
.checkbox.sm svg { width: 12px; height: 12px; }
.mytodo-hint { background: var(--st-done-bg); color: var(--st-done); font-size: 12.5px; font-weight: 600; border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mytodo-hint .btn { min-height: 32px; padding: 0 12px; font-size: 12px; }
.mytodo-add { display: flex; gap: 8px; margin-top: 4px; }
.mytodo-add input { flex: 1; min-height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); font: inherit; font-size: 13px; padding: 0 12px; }
.mytodo-add .btn { min-height: 38px; padding: 0 14px; }

/* ---------- 変更履歴 ---------- */
.hist-body { padding: 4px 20px 16px; display: grid; gap: 10px; }
.hist-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-filters select { height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); font: inherit; font-size: 12.5px; padding: 0 8px; max-width: 170px; }
.hist-list { display: grid; gap: 2px; }
.hist-line { display: flex; align-items: flex-start; gap: 9px; padding: 7px 8px; border-radius: 9px; font-size: 12.5px; line-height: 1.6; }
.hist-line:hover { background: var(--color-surface-hover); }
.hist-text { flex: 1; min-width: 0; color: var(--color-text-secondary); overflow-wrap: break-word; }
.hist-text b { color: var(--foreground); }
.hist-time { flex: none; color: var(--color-text-tertiary); font-size: 11.5px; padding-top: 1px; }
.hist-more { justify-self: start; min-height: 34px; padding: 0 14px; font-size: 12.5px; }
.ph-toggle { margin-left: auto; font-size: 12px; color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ph-toggle input { width: 15px; height: 15px; accent-color: var(--color-accent); }

/* ---------- 状況報告 ---------- */
.pu-body { padding: 4px 20px 16px; display: grid; gap: 12px; }
.pu-entry { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.pu-head { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.pu-health { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 3px 8px; }
.pu-health.h-ok { background: var(--st-done-bg); color: var(--st-done); }
.pu-health.h-risk { background: var(--st-confirm-bg); color: var(--st-confirm); }
.pu-health.h-block { background: var(--risk-bg); color: var(--risk); }
.pu-time { color: var(--color-text-tertiary); }
.pu-ops { margin-left: auto; display: inline-flex; gap: 2px; }
.pu-summary { font-size: 13.5px; line-height: 1.7; font-weight: 550; }
.pu-sec h5 { font-size: 11.5px; font-weight: 700; color: var(--color-text-tertiary); margin-bottom: 2px; }
.pu-sec p { font-size: 13px; line-height: 1.7; color: var(--color-text-secondary); white-space: pre-wrap; }

/* ---------- 段階ヘッダ進捗 / 詳細エディタ ---------- */
.tt-stage-prog { display: inline-flex; align-items: center; gap: 7px; justify-content: flex-end; }
.tt-stage-pct { font-size: 11.5px; color: var(--color-text-secondary); }
.stage-meta-editor { display: grid; gap: 8px; padding: 4px 12px 12px 40px; }
.stage-meta-editor input[type="text"] { min-height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--input); font: inherit; font-size: 13px; padding: 0 10px; }
.sm-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sm-dates input[type="date"] { min-height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--input); font: inherit; font-size: 12.5px; padding: 0 8px; }
.sm-dates .btn { min-height: 36px; padding: 0 14px; }

/* ---------- 段階管理の拡大 + 段階期間 + 課題行ドラッグ ---------- */
.modal.wide { width: min(780px, calc(100vw - 28px)); }
.modal.wide .mgr-list { max-height: 58vh; }
.tt-row.pj-dragging { opacity: 0.45; }
.tt-grip { display: inline-flex; color: var(--label-4); cursor: grab; padding: 4px 0; }
.tt-grip:hover { color: var(--color-text-secondary); }
.tt-grip svg { width: 15px; height: 15px; }
.tt-row:active .tt-grip { cursor: grabbing; }
.pj-grip { display: inline-flex; flex: none; color: var(--label-4); cursor: grab; margin-left: -6px; }
.pj-grip svg { width: 14px; height: 14px; }
.pj-item:hover .pj-grip { color: var(--color-text-secondary); }
@media (max-width: 1023px) { .tt .c-grip { display: none; } }
.tt-row.drop-above { box-shadow: inset 0 2px 0 var(--color-accent); }
.tt-row.drop-below { box-shadow: inset 0 -2px 0 var(--color-accent); }
