/* Task Board — 色などの決まり、画面の枠、部品の順に並べる。
   色は「文字色（--x）・薄い背景（--x-soft）・鮮やかな色（--x-solid：線や棒、点）」の組で持つ。
   文字色と薄い背景の組は、読みやすさの基準（WCAG AA、コントラスト比 4.5 以上）を満たす値にする。
   色だけに意味を持たせず、画面には必ず文字も出す。 */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --text: #172033;
  --muted: #56617a;
  --border: #e1e6f0;
  --primary: #1262cc;
  --primary-2: #36a3f7;
  --primary-soft: #e4efff;
  --solid: #1262cc;          /* 白い文字をのせる青 */
  --primary-text: #ffffff;
  --danger: #bd1330;  --danger-soft: #fde7ea;  --danger-solid: #c4162f;
  --warn: #8a4600;    --warn-soft: #fff0d6;
  --near: #9a3f00;    --near-soft: #ffe8d4;    --near-solid: #f26a0c;
  --ok: #0a6a30;
  --todo: #5b35c0;      --todo-soft: #eee8ff;      --todo-solid: #8b64f0;
  --progress: #0a54b0;  --progress-soft: #dcebff;  --progress-solid: #2487ff;
  --review: #854300;    --review-soft: #ffecc7;    --review-solid: #f79a10;
  --done: #0a6430;      --done-soft: #d8f4e0;      --done-solid: #1fae55;
  --teal: #0a5f6b;      --teal-soft: #d8f2f6;      --teal-solid: #12a5b8;
  --yellow: #665000;    --yellow-soft: #fff2bd;    --yellow-solid: #e5b800;
  --pink: #8c1a6b;      --pink-soft: #fce4f4;      --pink-solid: #d9469f;
  --neutral: #475269;   --neutral-soft: #ecf0f6;   --neutral-solid: #8b96ad;
  --sidebar: #112244;
  --sidebar-text: #cbd7f2;
  --sidebar-label: #93a8d4;
  --sidebar-active: #ffffff;
  --shadow-sm: 0 1px 2px rgba(18, 34, 68, .05);
  --shadow: 0 2px 6px rgba(18, 34, 68, .08), 0 8px 20px rgba(18, 34, 68, .08);
  --shadow-lg: 0 12px 32px rgba(18, 34, 68, .2);
  --radius: 10px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --motion: .22s;
  /* 右側のチャット列の幅（画面のスクリプトが、覚えている値で上書きする） */
  --panel-w: 360px;
  --panel-wide-w: 760px;
  /* 通常の形の幅：300px 以上で、本文に 600px 残る範囲（static/js/panel_toggle.js と同じ値にする） */
  --panel-col: clamp(300px, var(--panel-w), max(300px, min(720px, 100vw - 836px)));
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark; /* 入力欄のカレンダーやスクロールの帯も、暗い配色にする */
    --bg: #0f1522;
    --surface: #161e30;
    --surface-2: #1d263b;
    --text: #e8edf7;
    --muted: #a6b1ca;
    --border: #2c3752;
    --primary: #7ab6ff;
    --primary-2: #4aa8f5;
    --primary-soft: #17345c;
    --solid: #1565d1;
    --danger: #ff93a0;  --danger-soft: #47192a;
    --warn: #ffc261;    --warn-soft: #402e0d;
    --near: #ffab6b;    --near-soft: #4a2608;
    --ok: #66da92;
    --todo: #c8b4ff;      --todo-soft: #2f2558;      --todo-solid: #9c7bff;
    --progress: #95c7ff;  --progress-soft: #14335e;  --progress-solid: #3d95ff;
    --review: #ffc568;    --review-soft: #45300a;    --review-solid: #f5a524;
    --done: #74e0a0;      --done-soft: #103a22;      --done-solid: #2fbf68;
    --teal: #74d9e5;      --teal-soft: #0d363e;      --teal-solid: #22b8cc;
    --yellow: #f3d65f;    --yellow-soft: #3b3207;    --yellow-solid: #d9b210;
    --pink: #ffa5e0;      --pink-soft: #45173a;      --pink-solid: #e05aac;
    --neutral: #bcc5d8;   --neutral-soft: #29334c;   --neutral-solid: #7d89a3;
    --sidebar: #0a142b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Layout: sidebar + shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  display: flex; flex-direction: column; gap: 8px; padding: 16px 12px;
  background: var(--sidebar); color: var(--sidebar-text);
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--solid), var(--primary-2)); color: #fff;
  box-shadow: 0 4px 12px rgba(36, 135, 255, .45);
}
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.side-nav > * { flex: none; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px;
  color: var(--sidebar-text); font-weight: 500; transition: background .15s, color .15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.side-nav a.active { background: var(--solid); color: var(--sidebar-active); box-shadow: inset 4px 0 0 #7cc4ff, 0 4px 12px rgba(0, 0, 0, .25); }
.side-nav a.active .icon { color: #fff; }
.side-nav a.active .nav-badge:not(.alert):not(.result) { background: rgba(255, 255, 255, .24); }
.side-account { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-account form { margin: 0 0 0 auto; }
.side-name { color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account .icon-button { color: var(--sidebar-text); }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.content { padding: 24px 28px 48px; width: 100%; max-width: 1360px; }
.icon-button.menu-button { display: none; }
.sidebar-backdrop { display: none; }

.global-search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 38px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.global-search input { flex: 1; border: none; background: transparent; padding: 0; height: 100%; box-shadow: none; }
.global-search input:focus { outline: none; box-shadow: none; }
kbd {
  font: 600 11px/1 ui-monospace, monospace; padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.topbar .button-primary { margin-left: auto; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .4); }
  .shell { margin-left: 0; }
  .icon-button.menu-button { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 40px; }
  .global-search kbd { display: none; }
  .topbar .button-primary span { display: none; }
}

/* ---------- Buttons & inputs ---------- */
.button, .link-button, .icon-button { font: inherit; cursor: pointer; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, background .15s, border-color .15s, filter .15s;
  white-space: nowrap;
}
.button:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.button:not(:disabled):active { transform: scale(.96); }
.icon-button:not(:disabled):active { transform: scale(.9); }
.button:disabled { opacity: .6; cursor: default; }
.button-primary {
  background: var(--solid); border-color: transparent; color: var(--primary-text);
  box-shadow: 0 3px 10px rgba(18, 98, 204, .32);
}
.button-primary:hover { box-shadow: 0 6px 16px rgba(18, 98, 204, .45); border-color: transparent; filter: brightness(1.08); }
.button-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.button-danger-outline { color: var(--danger); }
.button-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.button-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.button-ghost:hover { background: var(--surface-2); color: var(--text); }
.button-sm { height: 30px; padding: 0 10px; font-size: .85rem; }
.link-button { background: none; border: none; color: var(--primary); padding: 0; }
.icon-button {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: transparent; border: none; color: var(--muted); transition: background .15s, color .15s, transform .15s;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
.required, .error { color: var(--danger); }
.error { margin: 4px 0; font-size: .85rem; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.crumbs:hover { color: var(--text); text-decoration: none; }
.count-pill { display: inline-block; min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card.narrow-wide { max-width: 560px; margin: 32px auto; }
.empty { color: var(--muted); padding: 28px 12px; text-align: center; }
.empty-state { display: grid; place-items: center; gap: 6px; padding: 32px 12px; color: var(--muted); text-align: center; }
.empty-state .icon { width: 28px; height: 28px; opacity: .6; }

/* ---------- Badges, status, priority, avatar ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-todo { background: var(--todo-soft); color: var(--todo); }
.status-in_progress { background: var(--progress-soft); color: var(--progress); }
.status-review { background: var(--review-soft); color: var(--review); }
.status-done { background: var(--done-soft); color: var(--done); }
.dot-todo { --c: var(--todo-solid); } .dot-in_progress { --c: var(--progress-solid); } .dot-review { --c: var(--review-solid); } .dot-done { --c: var(--done-solid); }

.status-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; border: none; border-radius: 999px;
  padding: 3px 26px 3px 12px; font-size: .78rem; font-weight: 700;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%;
  background-size: 4px 4px; background-repeat: no-repeat;
}
.status-select.status-todo { background-color: var(--todo-soft); }
.status-select.status-in_progress { background-color: var(--progress-soft); }
.status-select.status-review { background-color: var(--review-soft); }
.status-select.status-done { background-color: var(--done-soft); }
.status-select:focus { box-shadow: 0 0 0 3px var(--primary-soft); }
.status-select.saving { opacity: .6; }

.priority { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px 1px 7px; border-radius: 6px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.priority .icon { width: 13px; height: 13px; }
.priority-high { background: var(--danger-soft); color: var(--danger); }
.priority-normal { background: var(--yellow-soft); color: var(--yellow); }
.priority-low { background: var(--teal-soft); color: var(--teal); }

/* アバター：頭文字の丸。色は人ごとに固定（--h は色相） */
.avatar {
  --h: 240; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: hsl(var(--h) 85% 82%); color: hsl(var(--h) 80% 17%); font-size: .75rem; font-weight: 800;
  border: 2px solid var(--surface);
}
.avatar.lg { width: 36px; height: 36px; font-size: .9rem; }
.avatar.sm { width: 22px; height: 22px; font-size: .65rem; }
.avatar-empty { background: var(--surface-2); color: var(--muted); border-style: dashed; border-color: var(--neutral-solid); }

/* 期限：過ぎたら赤、今日・明日はオレンジ、それ以外は落ち着いた色 */
.due { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.due .icon { width: 14px; height: 14px; }
.overdue, .due.overdue { color: var(--danger); font-weight: 600; }
.due-near, .due.due-near { color: var(--near); font-weight: 600; }
.due.overdue, .due.due-near { padding: 0 8px; border-radius: 6px; background: var(--danger-soft); }
.due.due-near { background: var(--near-soft); }
.due-note { font-size: .75rem; font-weight: 700; }
.due-near-badge { background: var(--near-soft); color: var(--near); }
.meta-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.meta-chip .icon { width: 14px; height: 14px; }

/* ---------- Dashboard ---------- */
.hello h1 { font-size: 1.7rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px;
  background: color-mix(in srgb, var(--c, var(--primary)) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c, var(--primary)) 35%, var(--border)); border-radius: var(--radius); color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.stat-card::after { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c, var(--primary)); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.stat-number { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat-label { font-size: .85rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-alert { --c: var(--danger-solid); background: var(--danger-soft); }
.stat-alert .stat-number, .stat-alert .stat-label { color: var(--danger); }

.progress { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.progress span { background: var(--c); transition: width .3s ease; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 6px; }

/* 列の数は、使える幅で決まる（右のチャット列の幅を変えても崩れない。多くても2列） */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(420px, 40%)), 1fr)); gap: 16px; margin-top: 16px; }
.dash-grid .card + .card { margin-top: 0; }
.dash-grid .wide { grid-column: 1 / -1; }

/* ---------- Task rows (dashboard lists) ---------- */
.task-rows { list-style: none; margin: 0; padding: 0; }
.task-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 9px;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-2); }
.task-row .title { flex: 1; min-width: 0; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .title:hover { color: var(--primary); text-decoration: none; }

/* ---------- Filters & table ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input[type=search] { height: 36px; padding: 0 12px; }
.toolbar .spacer { flex: 1; }
.filters { display: contents; }
.toolbar .unit-select { min-width: 0; max-width: 100%; }
.unit-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 12px; overflow-wrap: anywhere; }
.unit-note > * { min-width: 0; }
.view-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.view-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; }
.view-switch a:hover { text-decoration: none; color: var(--text); }
.view-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.tasks { width: 100%; border-collapse: collapse; }
.tasks th, .tasks td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tasks td:first-child { white-space: normal; min-width: 240px; }
.tasks th { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.tasks tbody tr { transition: background .12s; }
.tasks tbody tr:hover { background: var(--surface-2); }
.tasks tbody tr:last-child td { border-bottom: none; }
.tasks .task-link { color: var(--text); font-weight: 600; }
.tasks .task-link:hover { color: var(--primary); }
.person { display: inline-flex; align-items: center; gap: 8px; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 18px 0; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 190px); min-height: 220px; transition: background .15s, border-color .15s; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 700; border-top: 4px solid var(--c); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.column-head::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.column-head .count-pill { margin-left: auto; }
.column-body { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; }
.column.drag-over { background: var(--primary-soft); border-color: var(--primary); }
.card-task {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  box-shadow: var(--shadow-sm); cursor: grab; transition: transform .18s, box-shadow .18s, opacity .15s;
  border-left: 3px solid var(--c, var(--border));
}
.card-task:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-task.dragging { opacity: .45; transform: rotate(1.5deg); }
.card-task .title { display: block; color: var(--text); font-weight: 600; margin-bottom: 10px; overflow-wrap: anywhere; }
.card-task .title:hover { color: var(--primary); text-decoration: none; }
.card-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-foot .avatar { margin-left: auto; }
.column-note { padding: 0 14px 12px; font-size: .8rem; color: var(--muted); }
.column-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 18px 8px; border: 2px dashed var(--border); border-radius: 10px; }
.column:not(.is-empty) .column-empty { display: none; }

/* ---------- Task detail ---------- */
/* 本文と右の列。幅が足りないとき（右のチャット列を広くしたときなど）は、右の列が下に回る */
.detail-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.detail-main { flex: 999 1 400px; min-width: 0; }
.detail-grid > .side-col { flex: 1 1 clamp(340px, 30%, 420px); min-width: 0; }

/* 主な属性の色付きの四角（状態・担当者・日程・優先度・種類） */
.attr-blocks { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.attr-block {
  --c: var(--neutral-solid); --soft: var(--surface-2); flex: 1 1 170px; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px;
  background: var(--soft); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border)); border-left: 6px solid var(--c); border-radius: var(--radius);
  transition: background var(--motion), border-color var(--motion), box-shadow var(--motion);
}
.attr-block:hover, .attr-block:focus-within { box-shadow: var(--shadow); }
.attr-label { display: flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--muted); }
.attr-block select.inline-input, .attr-block input.inline-input { width: 100%; max-width: 100%; padding: 5px 8px; }
.attr-status[data-value="todo"] { --c: var(--todo-solid); --soft: var(--todo-soft); }
.attr-status[data-value="in_progress"] { --c: var(--progress-solid); --soft: var(--progress-soft); }
.attr-status[data-value="review"] { --c: var(--review-solid); --soft: var(--review-soft); }
.attr-status[data-value="done"] { --c: var(--done-solid); --soft: var(--done-soft); }
.attr-status .inline-status-form { width: 100%; }
.attr-status .status-select { flex: 1; min-width: 0; padding-top: 7px; padding-bottom: 7px; font-size: .95rem; background-color: var(--surface); border: 1px solid var(--c); border-radius: var(--radius-sm); }
.attr-assignee { --c: var(--progress-solid); --soft: color-mix(in srgb, var(--progress-soft) 55%, var(--surface)); }
.attr-person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.attr-person-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.attr-schedule { flex: 2.4 1 330px; --c: var(--teal-solid); --soft: color-mix(in srgb, var(--teal-soft) 45%, var(--surface)); }
.attr-schedule:has(.due-flag.due-near) { --c: var(--near-solid); --soft: var(--near-soft); }
.attr-schedule:has(.due-flag.overdue) { --c: var(--danger-solid); --soft: var(--danger-soft); }
.due-flag { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.due-flag.overdue { color: var(--danger); }
.due-flag.due-near { color: var(--near); }
.attr-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.attr-date { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attr-priority[data-value="high"] { --c: var(--danger-solid); --soft: var(--danger-soft); }
.attr-priority[data-value="normal"] { --c: var(--yellow-solid); --soft: var(--yellow-soft); }
.attr-priority[data-value="low"] { --c: var(--teal-solid); --soft: var(--teal-soft); }
.attr-type .type-chip { max-width: 100%; align-self: flex-start; }
@media (max-width: 640px) {
  .attr-block { flex-basis: 100%; }
}
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-title h1 { font-size: 1.6rem; overflow-wrap: anywhere; }
.description { white-space: normal; overflow-wrap: anywhere; }
.section-label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px; }
.props { display: grid; grid-template-columns: 84px 1fr; gap: 12px 12px; margin: 0; align-items: center; }
.props dt { color: var(--muted); font-size: .85rem; }
.props dd { margin: 0; min-width: 0; }
/* 右の列は欄が多く画面より長くなるので、固定表示（sticky）にはしない */
.side-col { display: flex; flex-direction: column; gap: 12px; }
.side-col .card + .card { margin-top: 0; }

/* 右の列の欄（ウィジェット）。見出し（summary）を押すと開閉する。スクリプトがなくても開閉できる */
.card.widget { padding: 0; }
.widget, .widget [id] { scroll-margin-top: 80px; }
.widget-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px 14px; border-radius: var(--radius); cursor: pointer; list-style: none; user-select: none; }
.widget-head::-webkit-details-marker { display: none; }
.widget-head::before { content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.widget-box[open] > .widget-head::before { transform: rotate(45deg); }
.widget-head:hover { background: var(--surface-2); }
.widget-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.widget-head h2 { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: .95rem; }
.widget-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.widget-body { min-width: 0; padding: 2px 14px 14px; overflow-wrap: anywhere; }
.widget-body .button { height: auto; min-height: 30px; white-space: normal; }
.widget-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.widget-body .approval-list { margin-top: 0; }
.widget-body .actions + .approval-list { margin-top: 8px; }
.widget-body .file-list { margin: 0; }
.widget-body .file-list li { gap: 8px; }
.widget-body .file-list li:last-child { border-bottom: none; }
.widget-body .file-list .attach-thumb { width: 64px; height: 48px; }

/* Comments (chat) */
.comment-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; animation: pop .25s ease; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 10px; align-items: baseline; font-size: .85rem; flex-wrap: wrap; }
.comment-body {
  margin-top: 4px; padding: 10px 14px; border-radius: 4px 14px 14px 14px; background: var(--surface-2);
  border: 1px solid var(--border); overflow-wrap: anywhere; display: inline-block; max-width: 100%;
}
.comment.mine .comment-body { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }
.comment-tools { margin-left: auto; display: flex; gap: 12px; font-size: .8rem; opacity: 0; transition: opacity .15s; }
.comment:hover .comment-tools, .comment:focus-within .comment-tools { opacity: 1; }
@media (hover: none) { .comment-tools { opacity: 1; } }
.composer { display: flex; gap: 10px; align-items: flex-start; padding-top: 14px; border-top: 1px solid var(--border); }
.composer-box { flex: 1; min-width: 0; }
.comment-form textarea { width: 100%; min-height: 76px; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; font-size: .8rem; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(22, 163, 74, .6); animation: pulse 2s infinite; }
.comment-empty { padding: 12px 0; text-align: left; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

/* 添付ファイル */
.attach-list, .file-list { list-style: none; margin: 6px 0 0; padding: 0; }
.attach-list li { font-size: .85rem; overflow-wrap: anywhere; }
.attach-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; overflow-wrap: anywhere; }
.attach-delete { color: var(--muted); margin-left: 6px; }
.attach-field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; min-width: 0; }
.attach-label { font-size: .75rem; color: var(--muted); }
.attach-field input { max-width: 100%; font-size: .8rem; }
/* 入力欄の添付：送信ボタンの横のクリップ。選んだファイルの一覧は、ボタンの段の上に出す */
.comment-actions > span.muted { flex: 1 1 120px; min-width: 0; }
.comment-actions .attach-field { margin: 0 0 0 auto; }
.comment-actions .attach-selected { flex-basis: 100%; order: -1; margin: 0; }
/* スクリプトが使えるときだけ、本物の入力欄を透明にしてアイコンに重ねる（クリックもキーボードもそのまま使える） */
.js .attach-compact { position: relative; align-items: center; justify-content: center; width: 32px; height: 30px; border-radius: 8px; color: var(--muted); }
.js .attach-compact .attach-label { display: none; }
.js .attach-compact input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; font-size: 0; cursor: pointer; }
.js .attach-compact input::file-selector-button { cursor: pointer; }
.js .attach-compact:hover { background: var(--surface-2); color: var(--text); }
.js .attach-compact:focus-within { outline: 2px solid var(--primary); }
.js .attach-compact:has(input:disabled) { opacity: .5; }
@media (hover: none) { .js .attach-compact { width: 40px; height: 36px; } }
/* スクリプトが使えないとき：普通のファイル入力欄を1段使って出す */
html:not(.js) .attach-compact { flex-basis: 100%; }
html:not(.js) .attach-compact .icon { display: none; }
.file-list { margin: 0 0 12px; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.attach-selected { list-style: none; margin: 6px 0 0; padding: 0; max-height: 8.5em; overflow-y: auto; font-size: .82rem; }
.attach-selected li { display: flex; align-items: baseline; gap: 10px; }
.attach-selected-name { min-width: 0; overflow-wrap: anywhere; }
.attach-selected button { flex: none; cursor: pointer; }
.attach-selected button:disabled { color: var(--muted); cursor: default; }
/* ファイルをドラッグしている間、ドロップ先に重ねる案内（操作は下の要素へ通す） */
.drop-overlay {
  position: fixed; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px; text-align: center; pointer-events: none; border: 3px dashed var(--primary); border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-soft) 92%, transparent); color: var(--text);
}
.drop-overlay.unavailable { border-color: var(--muted); background: color-mix(in srgb, var(--surface-2) 94%, transparent); }
/* プレビュー：画像の小さい表示。読み込みの前後でスクロール位置がずれないように、枠の大きさを固定する */
.attach-thumb {
  display: block; width: min(240px, 100%); height: 150px; margin: 4px 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.attach-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.file-list .attach-thumb { flex: none; width: 96px; height: 72px; margin: 0; }
.attach-list .attach-thumb.broken, .file-list .attach-thumb.broken { display: none; }
.attach-preview { margin-left: 6px; font-size: .8rem; white-space: nowrap; }
/* 画像の拡大表示（preview.js が作る dialog） */
.image-viewer { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: transparent; }
.image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer::backdrop { background: rgba(0, 0, 0, .85); }
.image-viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); color: var(--text); }
.image-viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.image-viewer-bar .button { flex: none; }
.image-viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.image-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; background: var(--surface); }
.image-viewer-stage img[hidden], .image-viewer-error[hidden] { display: none; }
.image-viewer-error { margin: 0; padding: 14px 18px; border-radius: 8px; background: var(--surface); color: var(--text); }

/* 本文の URL のリンクと、URL のカード（狭いパネルでもはみ出さないように、長い文字は省略する） */
.text-link { overflow-wrap: anywhere; text-decoration: underline; }
.link-cards { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0; padding: 0; min-width: 0; }
.link-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: min(420px, 100%); min-width: 0; padding: 6px 10px;
  border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; background: var(--surface);
}
.link-card-link { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.link-card-kind { font-size: .72rem; font-weight: 700; color: var(--muted); }
/* ホスト名は省略せずに折り返す（後ろの部分が隠れると、接続先を見間違えるため） */
.link-card-host { font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.link-card-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: var(--muted); }
.link-card-preview { flex: none; }
html:not(.js) .link-card-preview { display: none; }
.link-card-warning { flex-basis: 100%; order: 1; font-size: .75rem; color: var(--danger); }
/* Google の資料のプレビュー（google_preview.js が作る dialog。上の帯と背景は画像の拡大表示と共通） */
.google-viewer-note { margin: 0; padding: 6px 14px; background: var(--surface-2); color: var(--text); font-size: .82rem; }
.google-viewer .image-viewer-stage iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }

/* History timeline */
.history-list { list-style: none; margin: 0; padding: 0 0 0 4px; }
.history-list > li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--border); }
.history-list > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.history-list > li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.history-list .comment-head { font-size: .82rem; }
.changes { margin: 4px 0 0; padding-left: 1em; font-size: .82rem; color: var(--muted); }
.changes .old { text-decoration: line-through; opacity: .8; }

/* ---------- Forms ---------- */
.task-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.task-form .field { display: flex; flex-direction: column; gap: 6px; }
.task-form .field label { font-weight: 600; font-size: .85rem; }
.task-form .field-title, .task-form .field-description { grid-column: 1 / -1; }
.task-form .field-title input { font-size: 1.15rem; font-weight: 600; padding: 10px 14px; }
.task-form input, .task-form select, .task-form textarea { width: 100%; }
.task-form .form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 16px; }
@media (max-width: 640px) { .task-form { grid-template-columns: 1fr; } }
.quote { margin: 12px 0; padding: 10px 14px; border-left: 4px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 380px; padding: 12px 16px 12px 14px; border-radius: 10px;
  background: var(--sidebar); color: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid var(--ok);
  animation: toast-in .3s ease; transition: opacity .3s, transform .3s;
}
.toast-error { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.auth-page { background: radial-gradient(1200px 600px at 10% -10%, rgba(139, 92, 246, .35), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(91, 91, 214, .35), transparent 60%), var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px; border-radius: 18px; box-shadow: var(--shadow-lg); }
.auth-card .brand { color: var(--text); padding: 0 0 20px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: .85rem; }
.auth-card input { width: 100%; height: 42px; }
.auth-card .button { width: 100%; height: 42px; margin-top: 6px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Status picker form: the button is only for browsers without JavaScript. */
.status-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.js .no-js-only { display: none; }
.toast-error { cursor: pointer; }

/* ---------- Small helpers ---------- */
.small { font-size: .82rem; }
.ink { color: var(--text); }
.icon-xs { width: 13px; height: 13px; vertical-align: -2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.segmented { display: inline-flex; gap: 4px; }
.title-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Sidebar groups & badges ---------- */
.side-label { margin: 14px 12px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; color: var(--sidebar-label); }
.side-label:first-child { margin-top: 0; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: rgba(255, 255, 255, .1); color: #fff;
}
.nav-badge.alert { background: var(--danger-solid); box-shadow: 0 0 0 3px rgba(255, 90, 110, .3); }
.nav-badge.result { background: var(--solid); white-space: nowrap; }
.nav-badge.result + .nav-badge { margin-left: -6px; }

/* ---------- Dashboard polish ---------- */
.hello {
  position: relative; overflow: hidden; padding: 22px 24px; border-radius: var(--radius);
  background: linear-gradient(120deg, #0d4796, #1262cc 55%, #6038c4); color: #fff; box-shadow: 0 10px 30px rgba(18, 98, 204, .28);
}
.hello::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hello .sub, .hello .muted { color: rgba(255, 255, 255, .85); }
.hello .button { position: relative; z-index: 1; }

/* Effort (工数) */
.effort-grid { margin-top: 16px; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 170px; padding-top: 6px; }
.wk-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.wk-val { font-size: .75rem; font-weight: 700; color: var(--muted); min-height: 1.2em; }
.wk-track { position: relative; flex: 1; width: 100%; max-width: 38px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.wk-bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px; background: linear-gradient(180deg, var(--primary-2), var(--solid)); transition: height .3s ease; }
.wk-day { font-size: .78rem; color: var(--muted); font-weight: 600; }
.wk-col.today .wk-day { color: var(--primary); }
.wk-col.today .wk-track { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.kpi-num { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi-num small { font-size: .8rem; font-weight: 700; color: var(--muted); margin-left: 2px; }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--solid), var(--primary-2)); transition: width .3s ease; }
.meter.over span { background: linear-gradient(90deg, var(--near-solid), var(--danger-solid)); }
.load-table { width: 100%; border-collapse: collapse; }
.load-table th, .load-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.load-table th { font-size: .75rem; color: var(--muted); font-weight: 700; }
.load-table tbody tr:last-child td { border-bottom: none; }
.load-col { width: 45%; }
.load-bar { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.load-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 55%, transparent), var(--primary)); }
.load-bar em { position: relative; z-index: 1; padding-left: 8px; font-style: normal; font-size: .78rem; font-weight: 700; line-height: 22px; color: var(--text); }

/* Effort card on the task page */
.effort-numbers { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.effort-numbers .big { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.effort .meter { margin-bottom: 4px; }
.time-form { display: grid; grid-template-columns: 1fr 76px; gap: 8px; margin: 12px 0; }
.time-form input { width: 100%; padding: 6px 10px; }
.time-form .button { grid-column: 1 / -1; }
.time-list { list-style: none; margin: 0; padding: 0; }
.time-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: .85rem; }
.time-list form { margin: 0 0 0 auto; }
.time-list .icon-button { width: 28px; height: 28px; }
.time-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- タスクの種類 ---------- */
.type-chip {
  display: inline-block; max-width: 180px; padding: 0 8px; border-radius: 6px; vertical-align: middle;
  font-size: .75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text); background: color-mix(in srgb, var(--tc) 20%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent); border-left: 5px solid var(--tc);
}
/* サブタスクの行は2段：1段目に状態とタイトル、2段目に種類・担当者・期限 */
.subtask-rows .task-row { flex-direction: column; align-items: stretch; gap: 3px; padding: 8px 4px; }
.subtask-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.subtask-line .badge { flex: none; }
.subtask-meta { font-size: .82rem; }
.subtask-rows .type-chip { flex: 0 1 auto; min-width: 0; max-width: 110px; }
.subtask-meta .person { flex: 0 1 auto; min-width: 0; gap: 4px; }
.subtask-meta .person .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-meta .due { flex: none; margin-left: auto; white-space: nowrap; }
.card-task .title:has(+ .card-type) { margin-bottom: 6px; }
.card-type { margin-bottom: 8px; line-height: 1.5; }
.type-list { list-style: none; margin: 0; padding: 0; }
.type-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.type-list li:last-child { border-bottom: none; }
.type-list .type-actions { display: flex; gap: 8px; margin-left: auto; }
.type-list li.is-hidden .type-chip { opacity: .65; }

/* ---------- 進捗ログ ---------- */
.progress-form { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 0 0 8px; }
.progress-form textarea { width: 100%; min-height: 76px; }
.progress-form .error { align-self: flex-start; margin: 0; }
.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list > li { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.progress-main { flex: 1; min-width: 0; }
.progress-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: .85rem; }
.progress-actions { display: flex; gap: 10px; margin-left: auto; }
.progress-body { overflow-wrap: anywhere; }
/* 記録の入力欄の下の段：クリップのボタンと「記録する」。選んだファイルの一覧はその上に出す */
.progress-submit { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; }
.progress-submit .attach-field { margin: 0; }
.progress-submit .attach-selected { flex-basis: 100%; order: -1; margin: 0; }
.progress-form .upload-status { align-self: flex-start; margin: 0; }

/* ---------- タスクの画面の直接入力 ---------- */
html:not(.js) .js-only { display: none !important; }
.detail-heading { flex: 1 1 320px; min-width: 0; }
.inline-field { min-width: 0; }
.inline-title .inline-view { display: flex; align-items: flex-start; gap: 6px; }
.inline-title h1 { min-width: 0; }
.inline-title input { width: 100%; font-size: 1.4rem; font-weight: 700; }
.js [data-edit-on-click] { cursor: text; border-radius: var(--radius-sm); }
.js [data-edit-on-click]:hover { background: var(--surface-2); }
.inline-field textarea { width: 100%; min-height: 160px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.props .inline-actions { justify-content: flex-start; }
.props .inline-input { width: 100%; max-width: 100%; padding: 5px 8px; }
.inline-status-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.inline-field.saving .inline-input { opacity: .6; }
.inline-message { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-size: .82rem; overflow-wrap: anywhere; }
.inline-message-ok { color: var(--ok); font-weight: 600; }
.inline-message-error { color: var(--danger); }
.inline-message-conflict, .inline-message-remote { padding: 8px 10px; border: 1px solid var(--warn); border-radius: 8px; background: var(--surface-2); }
.inline-message .inline-actions { justify-content: flex-start; margin: 0; }
.inline-message .button { height: auto; min-height: 30px; white-space: normal; }
.inline-current { max-height: 12em; overflow-y: auto; white-space: pre-wrap; color: var(--text); }
.description-card .section-label { margin: 0; }
.description-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.description-tools .desc-upload { display: flex; align-items: center; gap: 8px; margin: 0; }
.description-tools .attach-field { margin: 0; }
/* スクリプトが使えないときは普通のファイル入力欄が出るので、狭い画面でははみ出さないように折り返す */
html:not(.js) .description-card .card-head { flex-wrap: wrap; }
html:not(.js) .description-tools, html:not(.js) .description-tools .desc-upload { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.text-link-warning { margin-left: 4px; font-size: .82em; color: var(--danger); overflow-wrap: anywhere; }

/* ---------- Slack-style chat ---------- */
.chat { padding: 0; overflow: hidden; }
.chat-scroll { max-height: 560px; overflow-y: auto; padding: 8px 8px 4px; scroll-behavior: smooth; }
.chat-intro { display: grid; justify-items: start; gap: 4px; padding: 18px 12px; }
.chat-intro-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 6px; }
.chat .composer { margin: 0; padding: 12px 20px 16px; }
.chat .comment-list { gap: 0; margin: 0; }

.comment-list .comment { position: relative; gap: 12px; padding: 6px 12px; border-radius: 8px; transition: background .12s; animation: pop .2s ease; }
.comment-list .comment:hover, .comment-list .comment.picking { background: var(--surface-2); }
.comment-list .comment.compact { padding-top: 1px; padding-bottom: 1px; }
.msg-gutter { width: 36px; flex: none; display: flex; justify-content: center; }
.msg-time-hover { visibility: hidden; font-size: .7rem; color: var(--muted); line-height: 1.9; }
.comment:hover .msg-time-hover { visibility: visible; }
.comment-list .comment-head strong { font-size: .92rem; }
.comment-list .comment-body {
  display: block; margin-top: 0; padding: 0; border: none; border-radius: 0; background: none; line-height: 1.6;
}
.comment-list .comment.mine .comment-body { background: none; }
.comment.mine .comment-head strong { color: var(--primary); }
.edited { font-size: .75rem; }
.mention { padding: 0 3px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.day-divider { display: flex; align-items: center; gap: 12px; margin: 14px 12px 6px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-divider span { padding: 2px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }

.msg-actions {
  position: absolute; top: -14px; right: 12px; display: none; align-items: center; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); z-index: 3;
}
.comment:hover .msg-actions, .comment:focus-within .msg-actions, .comment.picking .msg-actions { display: flex; }
@media (hover: none) { .msg-actions { position: static; display: flex; box-shadow: none; border: none; background: none; margin-left: auto; } }
.msg-actions .icon-button { width: 30px; height: 30px; }
.msg-actions .comment-tools { display: contents; opacity: 1; }
/* 絵文字の選択欄：画面基準（fixed）で出すので、スクロール欄やパネルで切れない。位置は reactions.js が決める */
.emoji-picker {
  position: fixed; top: 0; left: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; padding: 6px;
  width: min(232px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 50;
}
.emoji-picker[hidden] { display: none; }
.emoji-picker button { height: 34px; min-width: 0; padding: 0; border: none; border-radius: 8px; background: none; font-size: 1.15rem; cursor: pointer; transition: transform .1s, background .1s; }
.emoji-picker button:hover, .emoji-picker button:focus-visible { background: var(--surface-2); transform: scale(1.15); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.reactions > :not(.alone) { margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); font: inherit; font-size: .82rem; color: var(--text);
  transition: border-color .12s, background .12s;
}
.reaction span { font-size: .75rem; font-weight: 700; color: var(--muted); }
.reaction:hover { border-color: var(--primary); }
.reaction.mine { background: var(--primary-soft); border-color: var(--primary); }
.reaction.mine span { color: var(--primary); }
/* 「リアクションを追加」ボタン：リアクションがあれば横に並べ、なければ本文の右下に控えめに出す（行の高さは増やさない） */
.comment-list .comment-main { position: relative; padding-right: 30px; }
.reaction-add {
  display: inline-grid; place-items: center; width: 30px; height: 24px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.reaction-add .icon { width: 15px; height: 15px; }
.reaction-add.alone { position: absolute; right: 0; bottom: 0; width: 26px; height: 22px; border-color: transparent; background: transparent; opacity: .45; }
.comment:hover .reaction-add.alone, .comment.picking .reaction-add.alone, .reaction-add.alone:focus-visible { border-color: var(--border); background: var(--surface); opacity: 1; }
.reaction-add:hover { border-color: var(--primary); color: var(--primary); }
/* マウスの画面：まとめ表示の行では、右上の操作ボタン（同じ機能がある）と重なるので隠す */
@media (hover: hover) { .detail-chat .comment.compact:hover .reaction-add.alone { visibility: hidden; } }
/* タッチの画面：押しやすい大きさにする。右上の操作ボタンの絵文字は重複するので出さない */
@media (hover: none) {
  .reaction { height: 30px; }
  .reaction-add { width: 36px; height: 30px; }
  .reaction-add.alone { width: 30px; height: 26px; opacity: .7; }
  .msg-actions .toolbar-react { display: none; }
}
html:not(.js) .reaction-add { display: none; }

.thread-summary:empty { display: none; }
.thread-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 3px 10px 3px 6px; border-radius: 8px;
  border: 1px solid transparent; background: none; font: inherit; font-size: .82rem; color: var(--primary); cursor: pointer;
}
.thread-link:hover { border-color: var(--border); background: var(--surface); }
.thread-link .icon { width: 15px; height: 15px; }

/* スレッド表示（チャット列の中で、本体と入れ替えて出す） */
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.thread-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 8px 4px 0; }
.thread-parent .comment-list { margin: 0; }
.thread-divider { display: flex; align-items: center; gap: 10px; margin: 6px 16px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.thread-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.thread-replies { margin: 0 0 8px; flex: 1; }
.thread-composer { position: sticky; bottom: 0; background: var(--surface); }
.thread-composer textarea { width: 100%; }

/* ---------- Gantt (v2) ---------- */
/* 左：タスクの表（横スクロールしても固定）、右：時間軸。行は同じ1つのスクロール枠に入れて、上下のずれを防ぐ。
   --dw（1日あたりの幅）はズームごとにテンプレートから渡す。 */
.gantt { --lw: 470px; --dw: 30px; --rh: 34px; --line: color-mix(in srgb, var(--border) 70%, transparent);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  container: gantt / inline-size; }
.gantt-hint { margin: -4px 0 12px; }
.g-js-only { display: none; }
.js .g-js-only { display: inline-flex; }
.g-zoom { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.g-zoom a { padding: 3px 12px; border-radius: 7px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.g-zoom a:hover { color: var(--text); text-decoration: none; }
.g-zoom a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* 横・縦のスクロールはこの枠の中だけ（ページ全体は横にスクロールしない） */
.g-scroll { overflow: auto; max-height: calc(100vh - 250px); min-height: 220px; overscroll-behavior: contain; }
.g-head, .g-row { display: grid; grid-template-columns: var(--lw) calc(var(--days) * var(--dw)); width: max-content; min-width: 100%; }

/* 左の表 */
.g-grid {
  position: sticky; left: 0; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) 44px 54px 54px 76px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.g-cell { display: flex; align-items: center; min-width: 0; height: var(--rh); padding: 0 8px; font-size: .8rem; }
.g-name { gap: 6px; padding-left: calc(8px + var(--level, 0) * 18px); }
.g-who { justify-content: center; }
.g-date { justify-content: flex-end; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-date.overdue { color: var(--danger); font-weight: 700; }
.g-date.due-near { color: var(--near); font-weight: 700; }
.g-date.overdue, .g-date.due-near { gap: 2px; padding: 0 3px; }
/* 色だけに頼らないよう、日付の前に「超」（期限切れ）「近」（今日・明日）を出す */
.g-date.overdue::before, .g-date.due-near::before { content: "超"; flex: none; padding: 0 2px; border-radius: 3px; font-size: .62rem; line-height: 1.5; background: var(--danger-soft); border: 1px solid currentColor; }
.g-date.due-near::before { content: "近"; background: var(--near-soft); }
.g-pct { gap: 6px; justify-content: flex-end; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-meter { flex: none; width: 28px; height: 4px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.g-meter i { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* 見出し（上下2段）。縦にスクロールしても上に固定 */
.g-head { position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.g-head .g-grid { z-index: 5; background: var(--surface-2); }
.g-grid-head .g-cell { height: 52px; align-items: flex-end; padding-bottom: 8px; font-size: .72rem; font-weight: 700; color: var(--muted); }
.g-head .g-timeline { position: relative; }
.g-tier { display: grid; grid-template-columns: repeat(var(--days), var(--dw)); }
.g-tier span { min-width: 0; overflow: hidden; white-space: nowrap; }
.g-tier-top span { height: 22px; padding: 4px 6px 0; font-size: .72rem; font-weight: 700; color: var(--text); border-left: 1px solid var(--border); }
.g-tier-bottom span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; height: 30px;
  font-size: .72rem; font-weight: 600; line-height: 1.1; color: var(--text); border-left: 1px solid var(--line);
}
.g-tier-bottom small { font-size: .6rem; font-weight: 500; color: var(--muted); }
.g-tier-bottom .we { color: var(--muted); }
.g-tier-bottom .edge { border-left-color: var(--border); }
.g-tier-bottom .today { color: var(--danger); font-weight: 800; }
.zoom-day .g-tier-bottom span.today { background: var(--danger-solid); color: #fff; border-radius: 6px; }
.zoom-day .g-tier-bottom span.today small { color: rgba(255, 255, 255, .85); }
.zoom-week .g-tier-bottom small { display: none; }
.g-today-tag {
  position: absolute; bottom: 2px; left: calc(var(--o) * var(--dw) + var(--dw) / 2); transform: translateX(-50%);
  padding: 0 6px; border-radius: 999px; background: var(--danger-solid); color: #fff; font-size: .6rem; font-style: normal; font-weight: 700; line-height: 14px; pointer-events: none;
}
.zoom-day .g-today-tag { display: none; }  /* 日ズームでは日付のセル自体を強調する */

/* 本体：目盛り線・週末・今日の線 */
.g-body { position: relative; }
.g-overlay {
  position: absolute; top: 0; bottom: 0; left: var(--lw); width: calc(var(--days) * var(--dw)); z-index: 0;
  display: grid; grid-template-columns: repeat(var(--days), var(--dw)); pointer-events: none;
}
.g-overlay span { border-left: 1px solid var(--line); }
.g-overlay span.edge { border-left-color: var(--border); }
.g-overlay span.we { background: color-mix(in srgb, var(--surface-2) 85%, var(--border)); opacity: .55; }
.g-today { position: absolute; top: 0; bottom: 0; z-index: 3; left: calc(var(--o) * var(--dw) + var(--dw) / 2 - 1px); width: 2px; background: var(--danger); opacity: .8; }

/* 行 */
.g-row { position: relative; z-index: 1; border-bottom: 1px solid var(--line); }
.g-row:hover .g-grid { background: var(--surface-2); }
.g-row:hover .g-timeline { background: color-mix(in srgb, var(--primary-soft) 30%, transparent); }
.g-row .g-timeline { position: relative; height: var(--rh); overflow: hidden; }
.g-row-group .g-grid { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.g-row-group .g-cell { font-weight: 700; }
.g-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
a.g-group-name:hover { color: var(--primary); text-decoration: none; }
.g-row-group .count-pill { flex: none; min-width: 20px; padding: 0 6px; font-size: .7rem; line-height: 1.5; }
.g-dot-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.g-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.g-row-task.level-1 .g-title { font-weight: 600; }
.g-title:hover { color: var(--primary); text-decoration: none; }
.g-parent-hint { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; color: var(--muted); }
.g-status { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.g-row.is-context .g-title { color: var(--muted); font-weight: 500; }
.g-row.is-context .g-bar, .g-row.is-context .g-milestone { opacity: .45; }

/* 開閉ボタン（JavaScript がないときは押しても動かないので隠す。行はすべて開いたまま表示） */
.g-toggle, .g-toggle-space { flex: none; width: 18px; height: 18px; }
.g-toggle {
  display: inline-grid; place-items: center; padding: 0; border: none; border-radius: 4px; background: transparent;
  color: var(--muted); cursor: pointer; visibility: hidden;
}
.js .g-toggle { visibility: visible; }
.g-toggle::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.g-toggle[aria-expanded="false"]::before { transform: translateX(-1px) rotate(-45deg); }
.g-toggle:hover { background: var(--border); color: var(--text); }

/* タスクのバー：状態の色、中の濃い部分が進捗 */
.g2 .g-bar {
  position: absolute; top: calc(var(--rh) / 2 - 9px); height: 18px;
  left: calc(var(--o) * var(--dw) + 1px); width: max(calc(var(--s) * var(--dw) - 2px), 6px);
  border-radius: 9px; cursor: grab; user-select: none; touch-action: none;
  background: color-mix(in srgb, var(--c) 28%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent);
  transition: left .15s ease, width .15s ease, box-shadow .15s, filter .15s;
}
.g2 .g-fill { position: absolute; inset: 0 auto 0 0; max-width: 100%; border-radius: inherit; background: var(--c); pointer-events: none; }
.g2 .status-todo { --c: var(--todo-solid); }
.g2 .status-in_progress { --c: var(--progress-solid); }
.g2 .status-review { --c: var(--review-solid); }
.g2 .status-done { --c: var(--done-solid); }
.g2 .g-bar.status-done { opacity: .8; }
.g2 .g-bar.is-near { box-shadow: 0 0 0 2px var(--near-solid); }
.g2 .g-bar.is-overdue { box-shadow: 0 0 0 2px var(--danger-solid); }
.g2 .g-bar:hover { filter: brightness(1.05); }
.g2 .g-bar.dragging { cursor: grabbing; transition: none; box-shadow: var(--shadow-lg); z-index: 3; }
.g2 .g-bar.saving, .g2 .g-milestone.saving { opacity: .6; }
.g2 .g-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.g2 .g-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g2 .g-bar.off, .g2 .g-milestone.off { display: none; }
.g2 .g-handle { position: absolute; top: 0; bottom: 0; z-index: 1; width: 8px; cursor: ew-resize; border-radius: 9px; }
.g2 .g-handle.l { left: 0; }
.g2 .g-handle.r { right: 0; }
.g2 .g-handle:hover { background: rgba(255, 255, 255, .4); }
.zoom-month .g-handle { width: 4px; }
/* バーの右に担当者の頭文字とタスク名 */
.g-meta {
  position: absolute; top: 50%; left: calc(100% + 6px); transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; pointer-events: none;
  font-size: .74rem; font-weight: 500; color: var(--text);
}
.g-meta .avatar.sm { width: 20px; height: 20px; font-size: .6rem; border-width: 1px; }
.g-meta-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* ◆ 日付が1つだけのタスク（マイルストーン） */
.g2 .g-milestone {
  position: absolute; top: calc(var(--rh) / 2 - 7px); left: calc(var(--o) * var(--dw) + var(--dw) / 2 - 7px);
  width: 14px; height: 14px; background: none; cursor: grab; touch-action: none; transition: left .15s ease;
}
.g2 .g-milestone::before {
  content: ""; position: absolute; inset: 1px; border-radius: 2px; transform: rotate(45deg);
  background: var(--c); box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(0, 0, 0, .25);
}
.g2 .g-milestone.is-near::before { box-shadow: 0 0 0 2px var(--near-solid); }
.g2 .g-milestone.is-overdue::before { box-shadow: 0 0 0 2px var(--danger-solid); }
.g2 .g-milestone.dragging { transition: none; cursor: grabbing; }
.g2 .g-milestone .g-meta { left: calc(100% + 8px); }

/* 要約バー（プロジェクト・親タスク）：細い括弧型。ドラッグはできない */
.g-summary {
  position: absolute; left: calc(var(--o) * var(--dw)); width: calc(var(--s) * var(--dw));
  bottom: 5px; height: 3px; background: color-mix(in srgb, var(--text) 45%, transparent); pointer-events: auto;
}
.g-summary::before, .g-summary::after { content: ""; position: absolute; top: 0; width: 2px; height: 7px; background: inherit; }
.g-summary::before { left: 0; }
.g-summary::after { right: 0; }
.g-summary.clip-l::before, .g-summary.clip-r::after { display: none; }
.g-summary ~ .g-bar, .g-summary ~ .g-milestone { top: 4px; }  /* 親タスクは自分のバーを少し上に寄せる */
.g-summary-project { bottom: auto; top: calc(var(--rh) / 2 - 3px); height: 5px; background: var(--pc, var(--muted)); border-radius: 1px; }
.g-summary-project::before, .g-summary-project::after { height: 9px; }

.gantt .empty-state { position: relative; z-index: 1; }
.js .g-name .panel-open-button { width: 24px; height: 24px; margin-left: auto; }
/* 左の表の幅と列は、画面の幅ではなくガントに使える幅で決める（右のチャット列を開くと狭くなるため）。
   --lw はコンテナー自身には指定できないので、内側の .g-scroll に指定する */
@container gantt (max-width: 899px) {
  .g-scroll { --lw: 350px; }
  .g-grid { grid-template-columns: minmax(0, 1fr) 40px 52px 52px; }
  .g-grid .g-pct { display: none; }
  .g-grid .g-date { padding: 0 4px; }
}
@container gantt (max-width: 699px) {
  .g-scroll { --lw: 240px; }
  .g-grid { grid-template-columns: minmax(0, 1fr) 36px; }
  .g-grid .g-date { display: none; }
}
@container gantt (max-width: 439px) {
  .g-scroll { --lw: 190px; }
  .g-grid { grid-template-columns: minmax(0, 1fr); }
  .g-grid .g-who, .g-grid .g-parent-hint { display: none; }
  .g-name { gap: 4px; padding-left: calc(4px + var(--level, 0) * 10px); padding-right: 4px; }
}

/* ---------- プロジェクト・サブタスク ---------- */
.project-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--pc, var(--primary)); }
.project-dot.lg { width: 16px; height: 16px; border-radius: 5px; }
.project-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 1px 9px 1px 7px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  color: var(--text); background: color-mix(in srgb, var(--pc) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pc) 50%, transparent);
}
.project-chip::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--pc); }
.project-chip:hover { text-decoration: none; background: color-mix(in srgb, var(--pc) 20%, var(--surface)); }
.parent-ref { display: block; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parent-ref:hover { color: var(--primary); text-decoration: none; }
.subtask-chip { padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.side-label-row { display: flex; align-items: center; justify-content: space-between; }
.side-add { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--sidebar-text); }
.side-add .icon { width: 14px; height: 14px; }
.side-add:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a.side-project { gap: 10px; padding-top: 7px; padding-bottom: 7px; }
.side-project-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav a.muted-link { font-size: .85rem; opacity: .7; }
.crumbs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.crumbs-row .crumbs { margin-bottom: 0; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { color: var(--border); }
.subtasks .meter { margin-bottom: 8px; }
.subtask-rows .person .small { color: var(--muted); }
.project-title { display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.project-progress { margin-top: 4px; }
.project-summary .description + .project-progress { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.color-field { border: none; margin: 0; padding: 0; }
.color-field legend { font-weight: 600; font-size: .85rem; margin-bottom: 6px; padding: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--pc); cursor: pointer; box-shadow: var(--shadow-sm); }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--pc); }
.swatch:has(input:checked)::after { content: "✓"; color: #fff; font-weight: 800; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 4px; }
.inline-form { display: inline-flex; margin: 0; }
/* ---------- Mentions ---------- */
/* 本文中の @ユーザー名：自分宛ては色を濃くして目立たせる */
.mention.me { background: var(--solid); color: var(--primary-text); }
/* 受信箱から開いたメッセージを一瞬だけ強調する */
.comment.mention-target { animation: mention-flash 2.4s ease-out; }
@keyframes mention-flash { 0%, 40% { background: var(--primary-soft); } 100% { background: transparent; } }

/* 入力補完の候補（入力欄の上に出す） */
.composer-box { position: relative; }
.chat:has(.mention-menu) { overflow: visible; } /* カードの角丸用の overflow で候補が切れないように */
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 30;
  width: min(340px, 100%); max-height: 240px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.mention-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.mention-option.active, .mention-option:hover { background: var(--primary-soft); }
.mention-option-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-option-user { margin-left: auto; font-size: .82rem; white-space: nowrap; }
.mention-menu-empty { padding: 8px 10px; font-size: .88rem; }

/* 受信箱 */
.mention-inbox { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.mention-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.mention-item:first-child { border-top: 0; }
.mention-item.unread { background: color-mix(in srgb, var(--primary-soft) 70%, transparent); box-shadow: inset 3px 0 0 var(--primary); }
.mention-main { flex: 1; min-width: 0; }
.mention-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.mention-head time { margin-left: 6px; font-size: .82rem; }
.mention-link { font-weight: 600; overflow-wrap: anywhere; }
.mention-item.unread .mention-head strong::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--primary); vertical-align: middle; }
.mention-excerpt { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.mention-read-form { flex-shrink: 0; }

/* ---------- 右側のチャット列（新着チャットの欄と、タスク画面のチャットで共通） ---------- */
/* 狭い画面では画面の外に隠しておき、「チャット」ボタンで重ねて開く。1200px 以上では次の3つの形（static/js/panel_toggle.js）：
   閉じる（本文が全幅）、通常（本文の右の列）、広げる（本文の大きさは変えず、上に重ねる）。
   スクリプトが使えないとき、新着チャットの欄は中身を読み込めないので出さない。タスク画面のチャットはページの下に出す。 */
body.has-panel .content { max-width: none; } /* 右側に余白を残さず、残りの幅を使う */
.chat-panel, .panel-fab, .panel-open-button, .panel-resizer, .panel-widen, .panel-scrim { display: none; }
.js .panel-open-button { display: inline-grid; width: 28px; height: 28px; flex: none; vertical-align: middle; }
/* 閉じている間は visibility で隠す（キーボードでも選べない）。開閉は横に滑らせる */
.js .chat-panel {
  display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; z-index: 35; width: min(360px, 100%);
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(100%); visibility: hidden; transition: transform var(--motion) ease, visibility 0s linear var(--motion);
}
.js body.panel-open .chat-panel { transform: none; visibility: visible; transition: transform var(--motion) ease; }
.js .panel-fab { display: inline-flex; position: fixed; right: 20px; bottom: 20px; z-index: 22; box-shadow: var(--shadow-lg); }
.js body.panel-open .panel-fab { display: none; }
.js body.has-panel .toast-stack { bottom: 76px; }
@media (max-width: 1199px) {
  .js body.has-panel .content { padding-bottom: 84px; } /* 下の「チャット」ボタンが、最後の操作に重ならないように */
}
@media (min-width: 1200px) {
  .js .chat-panel {
    width: var(--panel-col); z-index: 22; box-shadow: none; transform: none; visibility: visible;
    transition: transform var(--motion) ease, width var(--motion) ease, box-shadow var(--motion);
  }
  .js body.has-panel .shell { margin-right: var(--panel-col); transition: margin-right var(--motion) ease; }
  .js .panel-fab { display: none; }
  .js .panel-widen { display: inline-flex; }
  .js .panel-resizer { display: block; position: absolute; top: 0; bottom: 0; left: -4px; z-index: 5; width: 10px; cursor: ew-resize; touch-action: none; }
  .js .panel-resizer::after { content: ""; position: absolute; top: 50%; left: 3px; width: 4px; height: 44px; margin-top: -22px; border-radius: 999px; background: var(--neutral-solid); opacity: .45; transition: opacity .15s, background .15s, height .15s; }
  .js .panel-resizer:hover::after, .js .panel-resizer:focus-visible::after, .js body.panel-resizing .panel-resizer::after { height: 72px; background: var(--solid); opacity: 1; }
  .js body.has-panel .toast-stack { right: calc(var(--panel-col) + 20px); bottom: 20px; }
  /* 広げた形：本文の余白（margin-right）は通常のまま、チャット列だけを重ねる */
  .js body.panel-wide:not(.panel-collapsed) .chat-panel { width: clamp(var(--panel-col), var(--panel-wide-w), calc(100vw - 64px)); z-index: 41; box-shadow: var(--shadow-lg); }
  .js .panel-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10, 20, 43, .38); cursor: pointer; opacity: 0; visibility: hidden; transition: opacity var(--motion) ease, visibility 0s linear var(--motion); }
  .js body.panel-wide:not(.panel-collapsed) .panel-scrim { opacity: 1; visibility: visible; transition: opacity var(--motion) ease; }
  .js body.has-panel.panel-wide:not(.panel-collapsed) .toast-stack { right: auto; left: 20px; }
  .js body.panel-collapsed .chat-panel { transform: translateX(100%); visibility: hidden; transition: transform var(--motion) ease, visibility 0s linear var(--motion); }
  .js body.has-panel.panel-collapsed .shell { margin-right: 0; }
  .js body.panel-collapsed .panel-fab { display: inline-flex; }
  .js body.has-panel.panel-collapsed .content { padding-bottom: 84px; }
  .js body.has-panel.panel-collapsed .toast-stack { right: 20px; bottom: 76px; }
  /* 幅をドラッグしている間は、遅れて追いかけないようにする */
  .js body.panel-resizing { cursor: ew-resize; user-select: none; }
  .js body.panel-resizing .chat-panel, .js body.panel-resizing .shell { transition: none; }
}
.panel-head-actions { display: flex; align-items: center; gap: 4px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-status { margin: 0; padding: 8px 16px; background: var(--danger-soft); font-size: .85rem; }
.panel-feed-view, .panel-task-view, .panel-task, .chat-channel, .thread-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel-subtitle { margin: 0; padding: 10px 16px 6px; font-size: .8rem; color: var(--muted); }
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 6px 8px; }
.panel-note { margin: 8px 10px; font-size: .85rem; }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; text-align: left; cursor: pointer;
  border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit;
}
.feed-item:hover { background: var(--surface-2); }
.feed-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .85rem; }
.feed-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-head time { flex: none; font-size: .75rem; }
.feed-task { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 700; color: var(--primary); }
.feed-excerpt { font-size: .86rem; overflow-wrap: anywhere; }
.panel-task-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.panel-full-link { font-size: .82rem; }
.panel-task-title { width: 100%; margin: 0; font-size: .95rem; overflow-wrap: anywhere; max-height: 3.2em; overflow-y: auto; }
.panel-chat .comment-list { gap: 0; margin: 0; }
.panel-chat .comment-list .comment, .detail-chat .comment-list .comment { gap: 8px; padding-left: 6px; padding-right: 6px; }
.panel-chat a.thread-link { padding-left: 0; }
.panel-composer, .detail-chat .composer { margin: 0; padding: 10px 12px 12px; }
.panel-composer textarea, .detail-chat .composer textarea { width: 100%; min-height: 64px; }
/* タスク画面のチャット列：一覧が伸び縮みしてスクロールし、入力欄は下に固定する */
.detail-chat .thread-composer { margin-top: auto; }
.js .detail-chat .chat-scroll { max-height: none; scroll-behavior: auto; }
@media (hover: none) {
  /* 幅の狭い列では、操作ボタンを本文の下の段に置く */
  .detail-chat .comment-list .comment { flex-wrap: wrap; }
  .detail-chat .msg-actions { flex-basis: 100%; justify-content: flex-end; }
}
/* スクリプトが使えないとき：ページの下に並べる（閉じるボタンは働かないので出さない） */
html:not(.js) .detail-chat { display: flex; flex-direction: column; margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
html:not(.js) .detail-chat .chat-channel, html:not(.js) .detail-chat .chat-scroll { flex: none; }
html:not(.js) .detail-chat [data-panel-close] { display: none; }

/* ---------- 確認依頼 ---------- */
.approval-section { margin-bottom: 16px; border-left: 5px solid var(--neutral-solid); }
.approval-section#queue { border-left-color: var(--review-solid); }
.approval-section#orphaned { border-left-color: var(--danger-solid); }
.approval-section#results { border-left-color: var(--done-solid); }
.approval-section#mine { border-left-color: var(--progress-solid); }
.approval-section#conditions { border-left-color: var(--teal-solid); }
.approval-section.card + .card { margin-top: 0; }
.approval-list { list-style: none; margin: 8px 0 0; padding: 0; }
.approval-list > li { padding: 12px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.approval-list > li:first-child { border-top: none; }
.approval-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.approval-head form { margin: 0 0 0 auto; }
.approval-task { font-weight: 700; }
.approval-text { margin: 6px 0; }
.approval-decide textarea { display: block; width: 100%; margin: 4px 0 8px; }
.approval-reassign { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.role-tag { display: inline-block; padding: 0 8px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: var(--radius-sm); background: var(--neutral-soft); color: var(--neutral); font-size: 12px; font-weight: 700; }
.role-manager { background: var(--pink-soft); color: var(--pink); }
.role-gl { background: var(--todo-soft); color: var(--todo); }
.role-tl { background: var(--progress-soft); color: var(--progress); }
.role-ld { background: var(--teal-soft); color: var(--teal); }
.org-section { margin-bottom: 16px; border-top: 4px solid var(--progress-solid); }
#org-managers { border-top-color: var(--pink-solid); }
#org-unassigned { border-top-color: var(--neutral-solid); }
.org-team { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.org-people { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.org-people li { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.approval-pending { background: var(--review-soft); color: var(--review); }
.approval-approved { background: var(--done-soft); color: var(--done); }
.approval-conditional { background: var(--teal-soft); color: var(--teal); }
.approval-rejected { background: var(--danger-soft); color: var(--danger); }
.approval-withdrawn { background: var(--neutral-soft); color: var(--neutral); }
.alert-preview { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }

/* ---------- チームダッシュボード ---------- */
/* 列の数は、画面の幅ではなく本文に使える幅で決まる（右のチャット列を開くと狭くなるため） */
.tdash-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
/* 長いグループ名・チーム名・プロジェクト名があっても、狭い画面で横にはみ出さないように縮められるようにする */
.tdash-head > div { min-width: 0; overflow-wrap: anywhere; }
.tdash-filters .toolbar { margin: 0; min-width: 0; max-width: 100%; }
.tdash-filters select { min-width: 0; max-width: 100%; }
.tdash-shortcuts { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tdash-shortcuts a { padding: 4px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; }
.tdash-shortcuts a:hover { color: var(--text); text-decoration: none; }
.tdash-shortcuts a.active { background: var(--solid); color: var(--primary-text); }
.tdash-note { margin: 0 0 12px; overflow-wrap: anywhere; }
.card.tdash-kpi-card { padding: 0; overflow: hidden; container-type: inline-size; margin-bottom: 16px; }
.tdash-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--border); }
.tdash-kpi { background: var(--surface); box-shadow: inset 0 4px 0 var(--c, var(--primary)); }
.tdash-kpi > * { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px 18px 14px; color: var(--text); }
.tdash-kpi > a:hover { background: color-mix(in srgb, var(--primary-soft) 45%, transparent); text-decoration: none; }
.tdash-kpi > a .tdash-kpi-label::after { content: "›"; margin-left: auto; color: var(--primary); font-size: 1.1rem; line-height: 1; }
.tdash-kpi-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.tdash-kpi-num { font-size: 2.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tdash-kpi-num small { margin-left: 3px; font-size: 1rem; font-weight: 700; color: var(--muted); }
.tdash-kpi-sub { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.tdash-kpi-overdue { --c: var(--neutral-solid); }
.tdash-kpi-overdue.is-alert { --c: var(--danger-solid); background: var(--danger-soft); }
.tdash-kpi-overdue.is-alert > a:hover { background: transparent; box-shadow: inset 0 0 0 2px var(--danger-solid); }
.tdash-kpi-overdue.is-alert .tdash-kpi-num, .tdash-kpi-overdue.is-alert .tdash-kpi-num small,
.tdash-kpi-overdue.is-alert .tdash-kpi-label, .tdash-kpi-overdue.is-alert .tdash-kpi-sub { color: var(--danger); }
@container (max-width: 799px) {
  .tdash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tdash-kpi { grid-column: span 2; }
  .tdash-kpi:nth-child(n+4) { grid-column: span 3; }
}
@container (max-width: 459px) {
  .tdash-kpi, .tdash-kpi:nth-child(n+4) { grid-column: span 3; }
  .tdash-kpi:last-child { grid-column: 1 / -1; }
  .tdash-kpi-num { font-size: 2.2rem; }
}
.tdash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(400px, 40%)), 1fr)); gap: 16px; }
.tdash-grid .card { min-width: 0; container-type: inline-size; }
.tdash-grid .card + .card { margin-top: 0; }
.tdash-grid .wide { grid-column: 1 / -1; }
.tdash-grid .card-head { flex-wrap: wrap; }
.tdash-donut-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 28px; }
.tdash-donut { position: relative; width: 200px; max-width: 100%; }
.tdash-donut svg { display: block; width: 100%; height: auto; }
.tdash-donut circle { fill: none; stroke-width: 7; }
.tdash-donut-track { stroke: var(--surface-2); }
.tdash-donut-seg { stroke: var(--c); }
.tdash-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; pointer-events: none; }
.tdash-donut-center strong { font-size: 2.2rem; font-weight: 800; }
.tdash-donut-center span { color: var(--muted); font-size: .8rem; }
.tdash-legend { flex: 1; min-width: 200px; max-width: 320px; border-collapse: collapse; }
.tdash-legend th, .tdash-legend td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.tdash-legend th { text-align: left; font-weight: 600; }
.tdash-legend td strong { font-size: 1.25rem; margin-right: 1px; }
.tdash-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 3px; background: var(--c); }
.tdash-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; color: var(--muted); }
.tdash-key i { display: inline-block; width: 18px; height: 10px; margin-right: 6px; border-radius: 2px; }
/* 期限切れは、色に加えて斜線で区別する */
.tdash-seg-overdue { background: repeating-linear-gradient(135deg, var(--danger-solid) 0 4px, color-mix(in srgb, var(--danger-solid) 45%, var(--surface)) 4px 7px); }
.tdash-seg-rest { background: var(--progress-solid); }
.tdash-bars { width: 100%; table-layout: fixed; border-collapse: collapse; }
.tdash-bars th, .tdash-bars td { padding: 7px 4px; border-bottom: 1px solid var(--border); text-align: left; }
.tdash-bars thead th { color: var(--muted); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.tdash-bars thead th:first-child { width: 32%; }
.tdash-bars thead th.num { width: 7em; text-align: right; }
.tdash-bars thead th.num:nth-child(3) { width: 5em; }
.tdash-bars tbody th { font-weight: 500; }
.tdash-bars .person { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tdash-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdash-bars .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tdash-bar { display: flex; gap: 2px; height: 16px; }
.tdash-bar span { display: block; height: 100%; min-width: 3px; }
.tdash-bar span:last-child { border-radius: 0 4px 4px 0; }
.tdash-overdue-link { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-weight: 700; text-decoration: underline; }
.tdash-unassigned th, .tdash-unassigned td { background: var(--surface-2); }
@container (max-width: 419px) {
  .tdash-bars .avatar { display: none; }
  .tdash-bars thead th:first-child { width: 34%; }
  .tdash-bars thead th.num { width: 6em; }
  .tdash-bars thead th.num:nth-child(3) { width: 4em; }
}
.tdash-more { margin-top: 10px; }
.tdash-more summary, .tdash-rules summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.tdash-chart { display: grid; grid-template-columns: 3em minmax(0, 1fr); margin: 8px 14px 4px 0; }
.tdash-y { position: relative; }
.tdash-y span { position: absolute; right: 8px; transform: translateY(50%); color: var(--muted); font-size: .72rem; line-height: 1; }
.tdash-plot { height: 220px; }
.tdash-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tdash-gridline { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tdash-area { fill: var(--progress-solid); fill-opacity: .18; }
.tdash-line { fill: none; stroke: var(--progress-solid); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tdash-hit { fill: transparent; }
.tdash-hit:hover { fill: var(--progress-solid); fill-opacity: .16; }
.tdash-x { position: relative; grid-column: 2; height: 1.8em; }
.tdash-x span { position: absolute; top: 6px; transform: translateX(-50%); color: var(--muted); font-size: .72rem; line-height: 1; white-space: nowrap; }
.tdash-x span:first-child { transform: none; }
.tdash-x span:last-child { transform: translateX(-80%); }
.tdash-days { margin-top: 8px; border-collapse: collapse; }
.tdash-days th, .tdash-days td { padding: 4px 16px 4px 0; border-bottom: 1px solid var(--border); text-align: left; font-weight: 500; }
.tdash-rules { margin-top: 16px; }
.tdash-rules ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------- ホーム画面（総合ダッシュボード） ---------- */
/* 列の数は、画面の幅ではなく本文に使える幅で決める（右のチャット列を開くと狭くなるため） */
.home-head > div { min-width: 0; overflow-wrap: anywhere; }
.home-head h1 { position: relative; z-index: 1; word-break: keep-all; overflow-wrap: anywhere; } /* 狭い画面では、名前の空白の位置で改行する */
.home-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.home-stats .stat-card { gap: 6px; }
.home-stat-sub { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.home-stat-sub.overdue, .stat-alert .home-stat-sub { color: var(--danger); }
.home-section { margin: 0 0 22px; scroll-margin-top: 72px; }
.home-section.card + .card, .home-todo.card + .card { margin-top: 0; }
.home-section > h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.home-section h3 { margin: 0 0 6px; font-size: .92rem; }
.home-section .card-head { flex-wrap: wrap; }
.home-section .card-head h3 { margin: 0; }
.home-confirm { border-top: 4px solid var(--review-solid); container-type: inline-size; }
.home-confirm-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px 28px; align-items: start; }
.home-stuck, .home-requests { min-width: 0; }
@container (max-width: 859px) {
  .home-confirm-grid { grid-template-columns: minmax(0, 1fr); }
}
.home-table { width: 100%; border-collapse: collapse; }
.home-table th, .home-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.home-table thead th { color: var(--muted); font-size: .72rem; font-weight: 700; }
.home-table tbody th, .home-table tfoot th { font-weight: 600; }
.home-table .num { width: 1%; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-table td.num strong { font-size: 1.15rem; margin-right: 1px; }
.home-table .role-tag { margin-left: 6px; font-weight: 700; }
.home-table tr.is-orphaned > * { background: var(--danger-soft); }
.home-table tr.is-orphaned a { color: var(--danger); }
.home-table tr.is-active > * { background: var(--primary-soft); }
.home-table tr.is-active > th { box-shadow: inset 4px 0 0 var(--solid); padding-left: 12px; }
.home-sub { display: block; color: var(--muted); font-size: .76rem; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.home-filter-note { margin: 0 0 4px; font-size: .85rem; }
.home-request-list { list-style: none; margin: 6px 0 0; padding: 0; }
.home-request { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.home-request:first-child { border-top: none; }
.home-wait { flex: none; width: 58px; padding: 4px 0; border-radius: var(--radius-sm); background: var(--review-soft); color: var(--review); text-align: center; line-height: 1.2; }
.home-wait strong { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.home-wait span { font-size: .68rem; font-weight: 700; }
.home-request.is-overdue .home-wait { background: var(--danger-soft); color: var(--danger); }
.home-request-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.home-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.home-meta > span { min-width: 0; }
/* 1440px の画面で右のチャット列を開いていても、判断する側と依頼する側が横に並ぶ幅にする */
.home-todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(340px, 40%)), 1fr)); gap: 16px; }
.home-todo { min-width: 0; border-top: 4px solid var(--c, var(--primary)); }
/* 自分に関係する確認依頼の欄：対応があるときは枠と地の色で目立たせる（超過・今日が期限なら赤） */
.home-alert { --c: var(--neutral-solid); }
.home-requested { --c: var(--progress-solid); }
.home-alert.is-active { --c: var(--review-solid); border: 2px solid var(--c); border-top-width: 6px; background: color-mix(in srgb, var(--review-soft) 35%, var(--surface)); }
.home-alert.home-requested.is-active { --c: var(--progress-solid); background: color-mix(in srgb, var(--progress-soft) 35%, var(--surface)); }
.home-alert.is-urgent { --c: var(--danger-solid); border: 2px solid var(--c); border-top-width: 6px; background: color-mix(in srgb, var(--danger-soft) 40%, var(--surface)); }
.home-alert h4 { margin: 10px 0 2px; font-size: .82rem; color: var(--muted); }
.home-alert .home-list li.is-overdue, .home-alert .home-list li.is-near { padding-left: 10px; box-shadow: inset 4px 0 0 var(--danger-solid); }
.home-alert .home-list li.is-near { box-shadow: inset 4px 0 0 var(--near-solid); }
.home-figures { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 0 0 6px; }
.home-figures strong { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.home-figure strong { margin-right: 2px; font-size: 2.4rem; line-height: 1; }
.home-todo-late { --c: var(--danger-solid); }
.home-todo-soon { --c: var(--near-solid); }
.home-todo .task-row { flex-wrap: wrap; }
.home-todo .task-row .title { flex-basis: 140px; }
.home-alert .home-sub strong { color: var(--text); }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-list li { padding: 8px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.home-list li:first-child { border-top: none; }
.home-list li > a { font-weight: 600; margin-right: 6px; }
.home-warn { margin: 10px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); font-size: .85rem; font-weight: 600; }
.home-warn a { color: var(--danger); }
.home-units { border-top: 4px solid var(--progress-solid); container-type: inline-size; }
.home-bar-col { width: 34%; }
.home-unit-table .tdash-bar { height: 12px; }
.home-unit-group > * { background: var(--surface-2); }
.home-unit-team > th { padding-left: 24px; }
.home-unit-table tfoot > tr > * { border-top: 2px solid var(--border); border-bottom: none; font-weight: 800; }
@container (max-width: 559px) {
  .home-bar-col { display: none; }
  .home-confirm .home-table .role-tag { display: table; margin: 2px 0 0; }
}
/* 今後の機能の見本：点線の枠と札で、まだ動かないことが分かるようにする（重ねても浮き上がらせない） */
.home-future { container-type: inline-size; }
.home-future-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.home-sample { min-width: 0; padding: 16px; border: 2px dashed var(--neutral-solid); border-radius: var(--radius); background: var(--surface-2); }
.home-sample-wide { grid-column: 1 / -1; }
.home-sample header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.home-sample h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.home-sample-tag { padding: 2px 10px; border-radius: 999px; background: var(--yellow-soft); color: var(--yellow); border: 1px solid var(--yellow-solid); font-size: .75rem; font-weight: 800; }
.home-sample-note { margin: 10px 0 0; color: var(--muted); font-size: .8rem; }
.home-topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.home-topics li { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); overflow-wrap: anywhere; }
.home-topics strong { display: block; margin-bottom: 4px; }
.home-topics span { color: var(--muted); font-size: .85rem; }
.home-bars { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center; font-size: .82rem; }
.home-bar { height: 12px; }
.home-bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--neutral-solid); opacity: .55; }
.home-slides { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.home-slides li { aspect-ratio: 4 / 3; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: .72rem; text-align: center; overflow: hidden; }
.home-slides span { font-weight: 800; }

/* アプリの名前（長いので、サイドバーとログイン画面では折り返す。空白の位置で先に改行する） */
.brand-name { min-width: 0; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.sidebar .brand { font-size: .95rem; }
.sidebar .brand-mark { flex: none; }
.auth-card .brand-mark { flex: none; }

/* ---------- 動き ---------- */
/* 画面を開いたときだけ、本文の部品がふわっと現れる。印（page-enter）は少し後に外すので、
   自動更新やドラッグ＆ドロップで中身が入れ替わっても繰り返さない。固定表示の部品（チャット列など）は動かさない。 */
.page-enter .content > :not(.chat-panel, .emoji-picker, .panel-fab) { animation: rise .24s ease backwards; }
.page-enter .content > :nth-child(2) { animation-delay: .02s; }
.page-enter .content > :nth-child(3) { animation-delay: .04s; }
.page-enter .content > :nth-child(n+4):not(.chat-panel, .emoji-picker, .panel-fab) { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card { transition: box-shadow var(--motion), border-color var(--motion); }
.card:hover { box-shadow: var(--shadow); }
.chat-panel.card:hover { box-shadow: none; }
.feed-item { transition: background .15s, padding-left .15s; }
.feed-item:hover { padding-left: 14px; }
.side-nav a { transition: background .18s, color .18s, transform .15s; }
.side-nav a:active { transform: scale(.98); }

/* 端末で「視差効果を減らす（動きを減らす）」を選んでいる場合は、動きをなくす */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .stat-card:hover, .card-task:hover, .button:active, .icon-button:active, .side-nav a:active, .emoji-picker button:hover { transform: none !important; }
  .comment.mention-target { background: var(--primary-soft); }
}
