:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-border: #d8dee9;
  --color-text: #172b4d;
  --color-muted: #607087;
  --color-primary: #1d4ed8;
  --color-primary-hover: #1e40af;
  --color-danger: #d92d20;
  --color-danger-hover: #b42318;
  --color-success: #07845f;
  --radius: 6px;
  --shadow-subtle: 0 1px 2px rgba(9, 30, 66, 0.08);
  --shadow-raised: 0 6px 18px rgba(9, 30, 66, 0.08);

  --sidebar-bg: #172033;
  --sidebar-border: #263149;
  --sidebar-text: #dce3ef;
  --sidebar-text-muted: #9aa7ba;
  --sidebar-hover-bg: #22304a;
  --sidebar-active: #7db4ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-text);
  font-feature-settings: "palt" 1;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 全体レイアウト（左サイドバー＋メインエリア） ---- */
.app-shell { display: flex; height: 100vh; align-items: stretch; overflow: hidden; }

.sidebar {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  transition: width 0.15s ease, min-width 0.15s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-hover-bg) var(--sidebar-bg);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-hover-bg); border-radius: 3px; }
html.sidebar-collapsed .sidebar {
  display: none;
}
.sidebar__head { padding: 16px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar__logo { font-weight: 700; font-size: 16px; color: #fff; white-space: nowrap; }
.sidebar__nav { display: flex; flex-direction: column; padding: 12px 0; }
.sidebar__link {
  padding: 8px 16px;
  color: var(--sidebar-text);
  font-size: 14px;
  white-space: nowrap;
}
.sidebar__link:hover { background: var(--sidebar-hover-bg); text-decoration: none; color: #fff; }
.sidebar__boards { display: flex; flex-direction: column; padding: 4px 0 4px 12px; }
.sidebar__board-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  color: var(--sidebar-text-muted);
  font-size: 13px;
}
.sidebar__board-link-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__board-link:hover { background: var(--sidebar-hover-bg); text-decoration: none; color: var(--sidebar-text); }
.sidebar__board-link--active { color: var(--sidebar-active); font-weight: 600; }
.sidebar__boards[data-item-type] .sidebar__board-link { cursor: grab; }
.sidebar__board-link--dragging { opacity: 0.4; }
.sidebar__divider { height: 1px; background: var(--sidebar-border); margin: 8px 16px; }
.sidebar__link--toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: transparent; border: none; text-align: left; cursor: pointer; font: inherit; }
.sidebar__toggle-icon { transition: transform 0.15s ease; font-size: 16px; line-height: 1; }
.sidebar__link--toggle[aria-expanded="true"] .sidebar__toggle-icon { transform: rotate(-180deg); }
.sidebar__submenu { display: none; flex-direction: column; padding-left: 12px; }
.sidebar__submenu--open { display: flex; }
.sidebar__link--sub { font-size: 13px; color: var(--sidebar-text-muted); }
.sidebar__link--sub:hover { color: var(--sidebar-text); }

.app-content { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header__menu-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  padding: 6px 8px;
  line-height: 0;
}
.app-header__menu-btn:hover { background: var(--color-bg); border-radius: var(--radius); }
.app-header__menu-icon {
  display: inline-block;
  width: 18px;
  height: 12px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  position: relative;
}
.app-header__menu-icon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  border-top: 2px solid currentColor;
}
.app-header__right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.app-header__user { font-size: 14px; color: var(--color-muted); }
.app-header__logout { font-size: 14px; }

.app-main { flex: 1; min-height: 0; max-width: 98%; width: 100%; margin: 10px; padding: 6px 10px 0px; overflow-y: auto; }

.page h1 { font-size: 20px; line-height: 1.35; margin: 0; font-weight: 700; }

.page__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.board-desc { color: var(--color-muted); margin: 4px 0 0; font-size: 13px; }
.page__head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.page__grid { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

/* ---- 日報: 行を追加・削除できるミニテーブル(有給予定日・社長タスク・URL一覧) ---- */
.row-editor { display: flex; flex-direction: column; gap: 6px; }
.row-editor__row { display: flex; gap: 6px; align-items: center; }
.row-editor__row input, .row-editor__row select { flex: 1; min-width: 0; }
.row-editor__remove { flex-shrink: 0; }

/* ---- ボタン・フォーム共通 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: var(--shadow-subtle);
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn--active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn--active:hover { background: var(--color-primary-hover); }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-hover); color: #fff; }
.btn--danger { background: #fff; border-color: var(--color-danger); color: var(--color-danger); }
.btn--danger:hover { background: var(--color-danger); color: #fff; }
.btn--small { min-height: 28px; padding: 5px 10px; font-size: 12px; box-shadow: none; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--color-muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]),
select,
textarea {
  font: inherit;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  border-color: #7aa7f7;
  outline: 3px solid rgba(29, 78, 216, 0.12);
}
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin: 0;
  vertical-align: -3px;
}
input[type="file"] {
  font: inherit;
  font-size: 13px;
}
textarea { resize: vertical; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.inline-form--compact { display: inline-flex; margin: 0; }

.form-errors { color: var(--color-danger); padding-left: 20px; }
.form-notice { color: #006644; background: #e3fcef; padding: 10px 14px; border-radius: var(--radius); }

/* ---- カラーピッカー（プリセット見本 + 16進入力。ラベル管理などで使用） ---- */
.color-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.color-picker__swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.color-picker__swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  padding: 0;
}
.color-picker__swatch:hover { opacity: 0.85; }
.color-picker__swatch--selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-text); }
.color-picker__input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px 4px 4px 10px;
  background: var(--color-surface);
}
.color-picker__hex { border: none; padding: 4px 0; width: 90px; font-family: monospace; }
.color-picker__hex:focus { outline: none; }
.color-picker__preview { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }

.label-drag-handle { cursor: grab; color: var(--color-muted); font-size: 16px; padding: 0 6px; }
.label-drag-handle:active { cursor: grabbing; }
.data-table tr.is-ended { opacity: 0.55; }
#clients-table tr.is-ended td:nth-child(4) { text-decoration: line-through; }
#report-client-year-table tr.is-ended td:first-child,
#report-flat-table tr.is-ended td:first-child,
#report-client-year-ended-table tr.is-ended td:first-child,
#report-flat-ended-table tr.is-ended td:first-child { text-decoration: line-through; }
.data-table tr.table-section-row td {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-muted);
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ---- 軽量トースト（操作した箇所の近くに一瞬出す通知。ページ遷移せず完結する操作用） ---- */
.mini-toast {
  position: fixed;
  background: var(--color-text);
  color: #fff;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.mini-toast--visible { opacity: 1; transform: translateY(0); }

/* ---- 認証ページ ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.auth-box h1 { margin-top: 0; font-size: 20px; }
.auth-box__desc { color: var(--color-muted); font-size: 13px; }
.auth-box form { display: flex; flex-direction: column; gap: 14px; }

/* ---- 管理画面共通 ---- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-subtle);
}
.panel--danger { border-color: var(--color-danger); }
.panel h2 { margin-top: 0; font-size: 15px; line-height: 1.35; }

.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 16px;
  border-radius: var(--radius);
  color: var(--color-text-muted, #5e6c84);
  text-decoration: none;
  font-size: 14px;
}
.tab--small { padding: 3px 8px; font-size: 11px; font-weight: normal; }
.tab:hover { background: #ebecf0; }
.tab--active { background: var(--color-primary); color: #fff; }
.tab--active:hover { background: var(--color-primary); }

.bulk-actions { margin-bottom: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
/* 行数・列数が多い表でスクロールしても見出しが見えるように追従させる */
.data-table thead th {
  position: sticky;
  top: 0;
  background: #f7f9fc;
  z-index: 5;
  white-space: nowrap;
  color: #526173;
  font-size: 12px;
  font-weight: 700;
}
.data-table__actions { display: flex; gap: 8px; align-items: center; }
#report-client-year-table td { white-space: nowrap; }
/* 月の列数が多く横スクロールするため、クライアント名の列は左端に固定して常に見えるようにする */
#report-client-year-table th:first-child,
#report-client-year-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  z-index: 6;
}
#report-client-year-table thead th:first-child { z-index: 7; }
#report-client-year-table tbody tr:nth-child(odd) td:first-child { background: var(--color-surface); }
.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;
}
.month-cell { display: flex; align-items: center; gap: 4px; }
.month-cell-value {
  display: inline-flex; align-items: center; justify-content: flex-end;
  min-width: 42px; gap: 3px;
}
.month-fee-edit-btn {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 9px;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.month-fee-edit-btn:hover { color: var(--color-primary); border-color: #bfdbfe; background: #eff6ff; }
/* ネイティブのtitle属性はブラウザ・OSによって表示までのタイムラグや非表示になる場合があるため、
   確実にすぐ出る自前のホバーツールチップを使う */
.info-tooltip { position: relative; cursor: help; }
.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #172b4d;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-line;
  width: max-content;
  max-width: 240px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
.info-tooltip:hover::after,
.info-tooltip:focus::after { opacity: 1; visibility: visible; }
.info-tooltip--wide::after {
  max-width: 340px;
  text-align: left;
  /* 表の左端の列で使う想定のため、中央寄せにすると画面左にはみ出す。トリガーの左端に揃えて右方向にだけ広げる */
  left: 0;
  transform: none;
}
kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--color-bg);
  font-family: inherit;
  font-size: 12px;
}
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th:hover { color: var(--color-primary); }
.sortable-th::after { content: '\21C5'; margin-left: 4px; font-size: 10px; color: var(--color-muted); }
.sortable-th.sorted-asc::after { content: '\2191'; color: var(--color-primary); }
.sortable-th.sorted-desc::after { content: '\2193'; color: var(--color-primary); }
.table-search { margin-bottom: 10px; max-width: 260px; }
.report-group-row { background: var(--color-bg); }
.report-subrow { padding-left: 24px; color: var(--color-muted); }
.report-group-toggle {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.report-group-toggle-icon {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.report-group-toggle[aria-expanded="true"] .report-group-toggle-icon,
.report-client-toggle[aria-expanded="true"] .report-group-toggle-icon {
  transform: rotate(45deg);
}
.report-group-cell { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; row-gap: 4px; }
.report-note-label {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 9px;
  background: #f1f5f9;
  color: #526173;
  border: 1px solid #dbe3ee;
  font-size: 10px;
  font-weight: 700;
}

/* クライアント別・年間表の「クライアント」セルをクリックすると開く、社員種別ごとの実績内訳 */
.report-client-toggle {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.report-client-detail {
  margin-top: 8px; padding: 10px 12px; background: var(--color-bg);
  border-radius: var(--radius); font-size: 12px;
}
.report-detail-link { margin-left: 6px; text-decoration: none; font-size: 12px; vertical-align: middle; }
.report-detail-link:hover { opacity: 0.7; }
.report-client-detail__total { font-weight: 700; margin-bottom: 4px; }
.report-client-detail ul { list-style: none; margin: 0; padding-left: 10px; color: var(--color-muted); }
.report-client-detail li { margin-bottom: 2px; }
.report-client-detail__table-wrap { overflow-x: auto; }
.report-client-detail__table { border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.report-client-detail__table th, .report-client-detail__table td {
  padding: 3px 8px; border-bottom: 1px solid var(--color-border); text-align: right;
}
.report-client-detail__table th:first-child, .report-client-detail__table td:first-child { text-align: left; }
.report-client-detail__table thead th { color: var(--color-muted); font-weight: 600; }

.bias-detail-row td { background: var(--color-bg); }
.bias-chart { display: flex; flex-direction: column; gap: 6px; padding: 8px 4px; }
.bias-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bias-bar-label { width: 140px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bias-bar-track { flex: 1; background: var(--color-border); height: 8px; border-radius: 4px; overflow: hidden; }
.bias-bar-fill { height: 100%; background: var(--color-primary); }
.bias-bar-value { width: 110px; flex-shrink: 0; color: var(--color-muted); text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge--ok { background: #e3fcef; color: #006644; }
.badge--muted { background: #eef2f7; color: #526173; border: 1px solid #dbe3ee; }
.badge--priority-low { background: #e3fcef; color: #006644; }
.badge--priority-mid { background: #fffae6; color: #974f00; }
.badge--priority-high { background: #ffebe6; color: var(--color-danger); }

/* ---- 基準工数に対する進捗（凡例: 超過=薄赤、120%超過=濃赤、60%未満=青、80〜100%=黄） ---- */
.progress-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.progress-badge.progress-over100 { background: #ffebe6; color: var(--color-danger); }
.progress-badge.progress-over120 { background: var(--color-danger); color: #fff; }
.progress-badge.progress-under60 { background: #deebff; color: #0052cc; }
.progress-badge.progress-healthy { background: #fffae6; color: #974f00; }

/* ---- ボード一覧 ---- */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.board-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--color-text);
}
.board-card:hover { border-color: var(--color-primary); text-decoration: none; }
.board-card--mine { border-left: 4px solid var(--color-primary); }
.board-card h2 { margin: 0 0 6px; font-size: 16px; }
.board-card p { margin: 0 0 10px; color: var(--color-muted); font-size: 13px; }
.board-card__meta { font-size: 12px; color: var(--color-muted); }

/* ---- グループ（複数ボード串刺し表示） ---- */
.group-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.group-tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-text);
}
.group-tabs__tab:hover { border-color: var(--color-primary); text-decoration: none; }
.group-board__heading { margin: 20px 0 6px; }
.group-board__heading:first-of-type { margin-top: 0; }
a.card { color: var(--color-text); text-decoration: none; }

/* ---- カンバンボード ---- */
.page--board { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.list {
  background: #ebecf0;
  border-radius: var(--radius);
  width: 236px;
  min-width: 236px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 3px solid transparent;
  min-height: 0;
}
.list--over-capacity {
  border-top-color: var(--color-danger);
}
.list--over-capacity .list__totals span:first-child strong {
  color: var(--color-danger);
}
.list__capacity-input {
  grid-column: 2;
  grid-row: 1;
  width: 58px;
  min-height: 30px !important;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.2;
  padding: 5px 6px !important;
  color: var(--color-text);
  text-align: right;
  cursor: text;
}
.list__capacity-input:focus { border-color: var(--color-primary); outline: none; }
.list__capacity-input::placeholder { color: var(--color-muted); }
.list__capacity {
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  min-height: 30px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  font-size: 11px;
  color: var(--color-muted);
  flex-shrink: 0;
}
.list--group .list__head { grid-template-columns: 1fr 18px; }
.list--group .list__name { white-space: normal; overflow: visible; text-overflow: unset; word-break: break-word; }
.list--new {
  background: transparent;
  border: 1px dashed var(--color-border);
}
.list--new input {
  min-height: 30px !important;
  padding: 5px 8px !important;
  font-size: 13px;
}
.list__head { display: grid; grid-template-columns: 128px 58px 18px; align-items: center; gap: 6px; cursor: grab; user-select: none; -webkit-user-select: none; }
.list__head input { user-select: text; -webkit-user-select: text; }
.list__head-row { display: contents; min-width: 0; }
.list__head-row:first-child { display: contents; }
.list__name-input {
  grid-column: 1;
  grid-row: 1;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  min-height: 30px !important;
  padding: 5px 7px !important;
  min-width: 0;
  width: 100%;
  cursor: text;
}
.list__name-input:hover, .list__name-input:focus { background: var(--color-surface); }
.list__name { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 13px; padding: 2px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__delete {
  grid-column: 3;
  grid-row: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1;
  width: 18px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list__delete:hover { color: var(--color-danger); }
.list__head-row--capacity { display: contents; }
.list__totals {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  font-size: 11px;
  color: var(--color-muted);
  padding: 3px 2px 0;
  border-top: 1px solid rgba(9, 30, 66, 0.1);
  margin-top: 1px;
  padding-top: 4px;
}
.list__totals strong { color: var(--color-text); }
.list__cards { display: flex; flex-direction: column; gap: 5px; min-height: 10px; flex: 1; overflow-y: auto; }
.list__add-card {
  border: none;
  background: transparent;
  text-align: left;
  color: var(--color-muted);
  cursor: pointer;
  padding: 3px 2px;
  font-size: 12px;
}
.list__add-card:hover { color: var(--color-text); }

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 6px 8px;
  box-shadow: 0 1px 2px rgba(9, 30, 66, 0.15);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  user-select: none;
  -webkit-user-select: none;
}
.card:hover { box-shadow: 0 2px 6px rgba(9, 30, 66, 0.25); }
.card--done { opacity: 0.65; }
.card--no-client { background: #ffebe6; }
.card--google-event { background: #e6f0ff; }
.card--leave { background: #ebf9e9; }
.card--dragging { opacity: 0.4; }
.list__cards--drop-target { background: var(--color-bg); outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.list--dragging { opacity: 0.4; }
.list[data-category-id] > .list__head { cursor: grab; }
.list--draft { background: #f4f2ff; border-top: 3px solid #6554c0; }
.color-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(9, 30, 66, 0.15); vertical-align: middle; }
.card__top { display: flex; align-items: center; gap: 5px; }
.card__warning {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 9px;
  background: #fffae6;
  color: #974f00;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
}
.card__backlog-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 9px;
  background: #e3fcef;
  color: #006644;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.card__backlog-badge:hover { background: #abf5d1; }
.card__backlog-badge-icon { margin-left: 2px; font-size: 9px; }
.card__check {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: transparent;
  cursor: pointer;
  padding: 0;
  line-height: 0;
}
.card__check:hover { background: rgba(0, 82, 204, 0.1); }
.card__check svg { width: 9px; height: 9px; display: block; visibility: hidden; }
.card__check--done { background: #13c564; border-color: #13c564; }
.card__check--done svg { visibility: visible; }
.card__check--readonly { cursor: default; border-width: 1px; border-color: var(--color-border); }
.card__check--readonly.card__check--done { border-color: #13c564; }
.card__id-row { display: flex; align-items: center; gap: 5px; margin-bottom: 1px; }
.card__id { font-size: 10px; color: var(--color-muted); }
.card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.board--titles-collapsed .card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--color-muted); }
.card__due { color: var(--color-muted); }
.card__assignees { display: flex; gap: 3px; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar--xs { width: 16px; height: 16px; font-size: 9px; }
.avatar--sm { width: 22px; height: 22px; font-size: 11px; }
.avatar--lg { width: 64px; height: 64px; font-size: 24px; }
.card__footer { display: flex; gap: 8px; font-size: 11px; color: var(--color-muted); }
.card__date-range { font-size: 11px; font-weight: bold; color: var(--color-muted); }
.card__event-time { font-size: 11px; color: var(--color-muted); }
.card__client {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  color: var(--color-primary);
  background: #fff;
  padding: 0px 6px;
  border-radius: 10px;
}
.card__labels { display: flex; flex-wrap: wrap; gap: 3px; }
.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.card__labels .label-chip {
  font-size: 10px;
  font-weight: 400;
  padding: 0px 6px;
  border-radius: 10px;
  text-shadow: none;
}
.label-chip--pick { cursor: pointer; opacity: 0.5; }
.label-chip--pick.label-chip--selected { opacity: 1; box-shadow: 0 0 0 2px var(--color-text); }
.label-chip--foreign { cursor: default; }
.label-chip--foreign::after { content: '外部'; font-size: 9px; font-weight: 700; margin-left: 4px; color: inherit; opacity: 0.75; }
.label-chip__delete {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.label-new { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.label-new input[type="text"] { width: 160px; }
.label-new input[type="color"] { padding: 2px; width: 40px; height: 34px; }
.modal__row--column { flex-direction: column; align-items: flex-start; }

.sortable-ghost { opacity: 0.4; }

#new-list-name { width: 100%; margin-bottom: 8px; }

/* ---- モーダル ---- */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(9, 30, 66, 0.5); }
.modal__box {
  position: relative;
  background: var(--color-surface);
  max-width: 600px;
  width: calc(100% - 40px);
  margin: 40px auto;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-muted);
}
.modal__section { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--color-border); padding-top: 16px; }
.modal__section:first-child { border-top: none; padding-top: 0; }
.modal__row { display: flex; gap: 16px; flex-wrap: wrap; }
.modal__row > label { flex: 1; min-width: 140px; }
.modal__actions { display: flex; gap: 10px; }
.select-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--radius); max-height: 320px; overflow-y: auto; }
.select-list__item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none; border-bottom: 1px solid var(--color-border); }
.select-list__item[hidden] { display: none; }
.select-list__item:last-child { border-bottom: none; }
.select-list__item:hover { background: var(--color-bg); }
.select-list__item--selected { background: var(--color-primary); color: #fff; }
.select-list__item--selected:hover { background: var(--color-primary); color: #fff; }
.select-list__checkbox { flex-shrink: 0; pointer-events: none; }
.select-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.select-list__search { flex: 1; min-width: 160px; }
.select-list__weekdays { display: flex; gap: 4px; }
.select-list__weekday, .select-list__select-all {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
}
.select-list__weekday:hover, .select-list__select-all:hover { background: var(--color-bg); }
.select-list__select-all { font-weight: 600; }
.select-list__weekday--active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.assignee-list { display: flex; flex-wrap: wrap; gap: 10px; }
.assignee-check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--color-text); }
.attachment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.attachment { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.comment-list { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.comment { background: var(--color-bg); border-radius: var(--radius); padding: 8px 10px; }
.comment__meta { font-size: 12px; color: var(--color-muted); display: flex; gap: 8px; }
.comment__body { font-size: 14px; white-space: pre-wrap; }
.activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.activity-list--feed { max-height: none; }
.activity { font-size: 12px; border-bottom: 1px solid var(--color-border); padding-bottom: 8px; }
.activity__meta { color: var(--color-muted); display: flex; gap: 8px; justify-content: space-between; }
.activity__meta strong { color: var(--color-text); }
.activity__diff { margin-top: 2px; color: var(--color-text); white-space: pre-wrap; }
.muted { color: var(--color-muted); }
.log-payload { max-width: 480px; max-height: 200px; overflow: auto; font-size: 11px; white-space: pre-wrap; word-break: break-all; background: var(--color-bg); padding: 8px; border-radius: var(--radius); }

/* ---- 通知 ---- */
.notif { position: relative; }
.notif__bell {
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  border-radius: var(--radius);
}
.notif__bell:hover { background: var(--color-bg); }
.notif__bell-icon {
  display: inline-block;
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 18a2.5 2.5 0 0 0 2.35-1.65h-4.7A2.5 2.5 0 0 0 10 18Zm6-4.8-1.45-1.75V8a4.65 4.65 0 0 0-3.35-4.47V2.8a1.2 1.2 0 1 0-2.4 0v.73A4.65 4.65 0 0 0 5.45 8v3.45L4 13.2V15h12v-1.8ZM7.25 13.3V8a2.75 2.75 0 0 1 5.5 0v5.3h-5.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 18a2.5 2.5 0 0 0 2.35-1.65h-4.7A2.5 2.5 0 0 0 10 18Zm6-4.8-1.45-1.75V8a4.65 4.65 0 0 0-3.35-4.47V2.8a1.2 1.2 0 1 0-2.4 0v.73A4.65 4.65 0 0 0 5.45 8v3.45L4 13.2V15h12v-1.8ZM7.25 13.3V8a2.75 2.75 0 0 1 5.5 0v5.3h-5.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.notif__badge {
  position: absolute;
  top: -1px;
  right: -2px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  border-radius: 10px;
  padding: 1px 5px;
}
.notif__panel {
  position: absolute;
  right: 0;
  top: 36px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(9, 30, 66, 0.2);
}
.notif__item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 13px;
}
.notif__item:hover { background: var(--color-bg); text-decoration: none; }
.notif__item--unread { background: #e6f0ff; }
.notif__item time { color: var(--color-muted); font-size: 11px; }
.notif__empty { padding: 16px; color: var(--color-muted); font-size: 13px; }

.dropdown { position: relative; display: inline-block; }
.dropdown__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(9, 30, 66, 0.2);
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 2px;
  z-index: 50;
}
.dropdown__panel[hidden] { display: none; }

/* オンマウスで開くドロップダウン（クリック不要。並び替えメニュー等） */
/* ボタンとパネルの間に隙間(margin)があると、マウス移動中にhoverが途切れてパネルが消えてしまうため、
   marginではなくpadding-topで見た目の余白を作り、判定上の隙間を無くす(top:100%) */
.dropdown--hover .dropdown__panel { display: none; top: 100%; margin-top: 0; padding-top: 10px; }
.dropdown--hover:hover .dropdown__panel { display: flex; }
.dropdown__item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--color-text);
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown__item:hover { background: var(--color-bg); text-decoration: none; }

@media (max-width: 720px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; box-shadow: 2px 0 8px rgba(9, 30, 66, 0.2); width: 220px; }
  .modal__box { margin: 16px; width: calc(100% - 32px); }
}

/* ---- ヘルプページ ---- */
.help-layout { display: flex; align-items: flex-start; gap: 24px; }
.help-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.help-toc { width: 200px; flex-shrink: 0; }
.help-toc__inner {
  position: sticky;
  top: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}
.help-toc__title { display: block; margin-bottom: 10px; color: var(--color-text); }
.help-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help-toc a { color: var(--color-muted); font-size: 14px; }
.help-toc a:hover { color: var(--color-primary); text-decoration: none; }

.help-page h2 {
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}
.help-block { padding: 14px 16px; margin-bottom: 4px; background: var(--color-bg); border-radius: var(--radius); border-left: 3px solid var(--color-primary); }
.help-block:last-child { margin-bottom: 0; }
.help-block h3 { margin: 0 0 8px; font-size: 15px; }
.help-block ul { margin: 0; padding-left: 20px; }
.help-block li { margin-bottom: 4px; line-height: 1.6; }
.help-block li:last-child { margin-bottom: 0; }
.help-block ul ul { margin-top: 6px; }

.help-qa { padding: 12px 16px; margin-bottom: 10px; background: var(--color-bg); border-radius: var(--radius); border-left: 3px solid var(--color-success); }
.help-qa:last-child { margin-bottom: 0; }
.help-qa__q { margin: 0 0 6px; font-weight: 600; color: var(--color-text); }
.help-qa__q::before { content: "Q. "; color: var(--color-success); }
.help-qa__a { margin: 0; color: var(--color-text); line-height: 1.7; }
.help-qa__a::before { content: "A. "; color: var(--color-muted); font-weight: 600; }

.help-issue { padding: 12px 16px; margin-bottom: 10px; background: #fffae6; border-radius: var(--radius); border-left: 3px solid #ff991f; }
.help-issue:last-child { margin-bottom: 0; }
.help-issue__title { margin: 0 0 6px; font-weight: 600; color: #974f00; }
.help-issue p:last-child { margin-bottom: 0; line-height: 1.7; }
.help-issue--muted { background: var(--color-bg); border-left-color: var(--color-border); }
.help-issue--muted .help-issue__title { color: var(--color-text); }

@media (max-width: 900px) {
  .help-layout { flex-direction: column; }
  .help-toc { width: 100%; order: -1; }
  .help-toc__inner { position: static; }
  .help-toc ul { flex-direction: row; flex-wrap: wrap; gap: 14px; }
}

/* ---- Wiki ---- */
.wiki-body { line-height: 1.75; font-size: 14px; color: #24364f; }
.wiki-body h1, .wiki-body h2, .wiki-body h3 { margin: 22px 0 10px; color: #172b4d; line-height: 1.35; }
.wiki-body h1 { font-size: 22px; }
.wiki-body h2 { font-size: 18px; padding-bottom: 7px; border-bottom: 1px solid var(--color-border); }
.wiki-body h3 { font-size: 15px; }
.wiki-body h1:first-child, .wiki-body h2:first-child, .wiki-body h3:first-child { margin-top: 0; }
.wiki-body p { margin: 0 0 12px; }
.wiki-body ul, .wiki-body ol { margin: 0 0 12px; padding-left: 10px; }
.wiki-body li { margin-bottom: 4px; }
.wiki-body li::marker { font-weight: 700; }
.wiki-body blockquote { margin: 0 0 12px; padding: 9px 14px; border-left: 3px solid #94a3b8; color: #526173; background: #f7f9fc; }
.wiki-body code { background: var(--color-bg); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.wiki-body pre { background: #111827; color: #f3f4f6; padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; margin: 0 0 12px; }
.wiki-body pre code { background: none; padding: 0; color: inherit; }
.wiki-body hr { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }
.wiki-body .wiki-checklist-item { list-style: none; margin-left: -20px; }
.wiki-body table { border-collapse: collapse; margin: 0 0 14px; width: auto; max-width: 100%; font-size: 13px; }
.wiki-body td, .wiki-body th { border: 1px solid var(--color-border); padding: 6px 9px; }
.wiki-body tr:first-child td, .wiki-body th { background: #f7f9fc; font-weight: 700; color: #526173; }
.wiki-body img { max-width: 100%; }
.wiki-body .ql-align-center { text-align: center; }
.wiki-body .ql-align-right { text-align: right; }
.wiki-body .ql-align-justify { text-align: justify; }
/* Quillエディタで保存された本文（li[data-list]属性つき）のチェックリスト・箇条書き・番号付きリストの
   見た目をQuillの編集画面と揃える。旧Markdown由来の素の<li>（属性なし）はブラウザ標準の見た目のまま
   （list-style:noneにしない）にして、移行前後どちらのページも自然に表示されるようにする */
.wiki-body li[data-list] { list-style-type: none; padding-left: .5em; position: relative; }
.wiki-body li[data-list] > .ql-ui { color: #777; }
.wiki-body li[data-list] > .ql-ui::before { display: inline-block; margin-left: -.5em; margin-right: .3em; text-align: right; white-space: nowrap; width: 1.2em; font-weight: 700; }
.wiki-body li[data-list="bullet"] > .ql-ui::before { content: '\2022'; }
.wiki-body li[data-list="checked"] > .ql-ui::before { content: '\2611'; }
.wiki-body li[data-list="unchecked"] > .ql-ui::before { content: '\2610'; }
.wiki-body li[data-list="ordered"] { counter-increment: wiki-list-0; }
.wiki-body li[data-list="ordered"] > .ql-ui::before { content: counter(wiki-list-0, decimal) '. '; }
.wiki-body li[data-list] { counter-reset: wiki-list-1 wiki-list-2 wiki-list-3 wiki-list-4; }
.wiki-body li[data-list="ordered"].ql-indent-1 { counter-increment: wiki-list-1; }
.wiki-body li[data-list="ordered"].ql-indent-1 > .ql-ui::before { content: counter(wiki-list-1, lower-alpha) '. '; }
.wiki-body li[data-list].ql-indent-1 { counter-reset: wiki-list-2 wiki-list-3 wiki-list-4; }
.wiki-body li[data-list="ordered"].ql-indent-2 { counter-increment: wiki-list-2; }
.wiki-body li[data-list="ordered"].ql-indent-2 > .ql-ui::before { content: counter(wiki-list-2, lower-roman) '. '; }
.wiki-body li[data-list].ql-indent-2 { counter-reset: wiki-list-3 wiki-list-4; }
.wiki-body .ql-indent-1 { padding-left: 3em; }
.wiki-body li.ql-indent-1 { padding-left: 4.5em; }
.wiki-body .ql-indent-2 { padding-left: 6em; }
.wiki-body li.ql-indent-2 { padding-left: 7.5em; }
.wiki-body .ql-indent-3 { padding-left: 9em; }
.wiki-body li.ql-indent-3 { padding-left: 10.5em; }
.wiki-body .ql-indent-4 { padding-left: 12em; }
.wiki-body li.ql-indent-4 { padding-left: 13.5em; }
.wiki-body .ql-code-block-container { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #172b4d; color: #eee; padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; margin: 0 0 12px; }

/* ---- Wikiサイドナビ（カテゴリのツリー表示） ---- */
/* align-itemsをstretchにして、サイドナビ側の高さをメインコンテンツと揃える。
   flex-startのままだと、サイドナビの実際の箱（containing block）がツリーの中身分の高さしか無くなり、
   sticky（追従）が機能する余地（スクロール可能な範囲）自体が無くなってしまうため */
.wiki-layout { display: flex; align-items: stretch; gap: 18px; color: #1f2f46; }
.wiki-tree-nav { width: 252px; flex-shrink: 0; }
.wiki-tree-nav__inner {
  position: sticky;
  top: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  box-shadow: var(--shadow-subtle);
}
.wiki-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.wiki-tree__all-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.wiki-tree__all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  color: var(--color-text);
}
.wiki-tree__manage-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border-radius: 4px;
  color: var(--color-muted);
  font-size: 14px;
}
.wiki-tree__manage-btn:hover { background: var(--color-bg); color: var(--color-primary); text-decoration: none; }
.wiki-tree__all::before {
  content: "";
  width: 13px;
  height: 15px;
  border: 1.5px solid #7a8aa0;
  border-radius: 2px;
  box-shadow: inset 0 -4px 0 rgba(122, 138, 160, 0.12);
  flex-shrink: 0;
}
.wiki-tree__all:hover { background: var(--color-bg); text-decoration: none; }
.wiki-tree__category { margin-bottom: 3px; border-radius: 4px; }
.wiki-tree__category[draggable="true"] { cursor: default; }
.wiki-tree__category--dragging { opacity: 0.4; }
.wiki-tree__category--nest-target > .wiki-tree__category-header { background: var(--color-bg); outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.wiki-tree__category-header {
  cursor: pointer; padding: 6px 7px; font-size: 13px; color: #24364f;
  display: flex; align-items: center; gap: 6px; border-radius: 4px;
}
.wiki-tree__category-header:hover { background: var(--color-bg); }
.wiki-tree__category-header .wiki-tree__name,
.wiki-tree__subcategory-header .wiki-tree__name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.wiki-tree__category-header .wiki-tree__name::before {
  content: "";
  width: 13px;
  height: 10px;
  border: 1.5px solid #8090a6;
  border-top-width: 4px;
  border-radius: 2px;
  background: #fff;
  flex-shrink: 0;
}
.wiki-tree__subcategory-header .wiki-tree__name::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid #9aa7ba;
  border-radius: 2px;
  background: #fff;
  flex-shrink: 0;
}
.wiki-tree__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-tree__handle { cursor: grab; color: var(--color-muted); font-size: 12px; flex-shrink: 0; }
.wiki-tree__handle:active { cursor: grabbing; }
.wiki-tree__pages {
  display: none; list-style: none; margin: 0 0 5px; padding-left: 14px;
  flex-direction: column; gap: 2px;
}
.wiki-tree__pages a {
  font-size: 12px;
  line-height: 1.35;
  color: var(--color-muted);
  display: block;
  padding: 4px 7px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wiki-tree__pages a::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: #b4bfce;
  vertical-align: 2px;
}
.wiki-tree__pages a:hover { background: var(--color-bg); text-decoration: none; }
.wiki-tree__pages li[draggable="true"] { cursor: grab; }
.wiki-tree__page--dragging { opacity: 0.4; }
.wiki-tree__drop-target { background: var(--color-bg); outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.wiki-tree__link--active { background: #dbeafe; color: var(--color-primary) !important; font-weight: 700; }
.wiki-tree__link--active::before { background: var(--color-primary); }

.wiki-tree__subcategories { display: none; padding-left: 8px; margin: 0 0 4px; border-left: 1px solid var(--color-border); }
.wiki-tree__category--open > .wiki-tree__subcategories { display: block; }
.wiki-tree__pages.wiki-tree__pages--direct { display: flex; }
.wiki-tree__subcategory { margin-bottom: 2px; border-radius: 4px; }
.wiki-tree__subcategory[draggable="true"] { cursor: default; }
.wiki-tree__subcategory--dragging { opacity: 0.4; }
.wiki-tree__subcategory-header {
  cursor: pointer; padding: 5px 7px; font-size: 12px; color: var(--color-text);
  display: flex; align-items: center; gap: 6px; border-radius: 4px;
}
.wiki-tree__subcategory-header:hover { background: var(--color-bg); }
.wiki-tree__subcategory--open > .wiki-tree__pages { display: flex; }
@media (max-width: 900px) {
  .wiki-layout { flex-direction: column; }
  .wiki-tree-nav { width: 100%; order: -1; }
  .wiki-tree-nav__inner { position: static; max-height: none; }
}

/* ---- Wiki編集フォーム：セクション分け ---- */
.wiki-form-section { border-top: 2px solid var(--color-primary); }
.wiki-form-section__title { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.wiki-form-section__hint { color: var(--color-muted); font-size: 12px; margin: -4px 0 10px; }
.wiki-form-section__label { display: block; font-weight: 600; margin-bottom: 2px; }
.wiki-keyword-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) {
  .wiki-keyword-grid { grid-template-columns: 1fr; }
}

/* ---- Wikiタグチップ入力（関連キーワード・除外キーワード） ---- */
.wiki-tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 6px 8px; background: var(--color-surface);
}
.wiki-tag-input:focus-within { border-color: var(--color-primary); }
.wiki-tag-input__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wiki-tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 999px;
  padding: 2px 4px 2px 10px; font-size: 13px; white-space: nowrap;
}
.wiki-tag-chip__remove { background: none; border: none; cursor: pointer; color: var(--color-muted); font-size: 14px; line-height: 1; padding: 2px 6px; }
.wiki-tag-chip__remove:hover { color: var(--color-danger); }
.wiki-tag-input__field { flex: 1; min-width: 140px; border: none; outline: none; padding: 4px; font-size: 13px; }

/* ---- Wiki本文編集：Quillリッチテキストエディタ ---- */
.wiki-editor-toolbar.ql-toolbar.ql-snow { border-radius: var(--radius) var(--radius) 0 0; background: #f7f9fc; border-color: var(--color-border); position: sticky; top: 0; z-index: 8; }
.wiki-quill-editor.ql-container.ql-snow { border-radius: 0 0 var(--radius) var(--radius); background: var(--color-surface); border-color: var(--color-border); }
.wiki-quill-editor .ql-editor { min-height: 320px; font-size: 14px; line-height: 1.8; }
#wiki-insert-hr, #wiki-insert-table {
  background: none; border: none; cursor: pointer; width: 28px; height: 24px; padding: 3px 5px;
  font-size: 14px; color: #444;
}
#wiki-insert-hr:hover, #wiki-insert-table:hover { color: var(--color-primary); }
/* Quillのデフォルト（英語）ラベルを日本語に置き換える */
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before { content: '標準'; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: '見出し1'; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: '見出し2'; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: '見出し3'; }
.ql-snow .ql-tooltip::before { content: 'リンク先: '; }
.ql-snow .ql-tooltip[data-mode="link"]::before { content: 'リンク先URLを入力: '; }
.ql-snow .ql-tooltip a.ql-action::after { content: '編集'; }
.ql-snow .ql-tooltip a.ql-remove::before { content: '削除'; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: '保存'; }
.wiki-popular-list, .wiki-review-list { margin: 0; padding-left: 20px; }
.wiki-popular-list li, .wiki-review-list li { margin-bottom: 6px; }
.wiki-match-list { margin: 0; padding-left: 20px; }
.wiki-match-list li { margin-bottom: 4px; }
.wiki-panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wiki-panel-row .panel { margin: 0; }
.wiki-panel-row + .wiki-alert { margin-top: 12px; }
@media (max-width: 900px) { .wiki-panel-row { grid-template-columns: 1fr; } }
.wiki-dashboard-card { background: #f7f9fc; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 16px; }
.dashboard-list { list-style: none; margin: 0; padding: 0; }
.dashboard-list li { padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.dashboard-list li:last-child { border-bottom: none; }
.dashboard-list .wiki-pill { margin-left: 6px; }
.dashboard-chart-panel { grid-column: 1 / -1; }
.dashboard-chart-panel svg { display: block; overflow: visible; }
.dashboard-leave-cols { display: grid; grid-template-columns: 1fr; gap: 20px; }
.dashboard-leave-col__head { font-size: 13px; margin: 0 0 6px; color: var(--color-muted); }
.dashboard-leave-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dashboard-leave-table th, .dashboard-leave-table td { padding: 5px 8px; border-bottom: 1px solid var(--color-border); text-align: left; }
.dashboard-leave-table th { width: 70px; font-weight: 600; white-space: nowrap; }
.dashboard-leave-table th .muted { display: block; font-size: 10px; font-weight: 400; }
.dashboard-availability-group { margin-bottom: 18px; }
.dashboard-availability-group:last-child { margin-bottom: 0; }
.dashboard-availability-group svg { display: block; overflow: visible; max-width: 560px; }
.wiki-dashboard-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--color-text); }
.wiki-category-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.wiki-category-list form { display: inline-flex; align-items: center; }
.wiki-filter-bar { margin-bottom: 12px; padding: 10px 12px; background: #f7f9fc; border: 1px solid var(--color-border); border-radius: var(--radius); }
.wiki-checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-height: 34px;
}
.wiki-tag-cloud { margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.wiki-tag-cloud .badge { text-decoration: none; }
.wiki-tag--active { background: var(--color-primary) !important; color: #fff !important; }
.wiki-tag-details { margin-bottom: 10px; }
.wiki-tag-details summary { cursor: pointer; color: var(--color-primary); font-size: 13px; margin-bottom: 8px; }
.wiki-tag-details .wiki-tag-cloud { margin-bottom: 0; max-height: 220px; overflow-y: auto; }
.wiki-favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  vertical-align: middle;
  padding: 0;
  color: #c7ced9;
}
.wiki-favorite-btn:hover { color: #f5b400; }
.wiki-favorite-btn--active { color: #f5b400; }
.wiki-breadcrumb { font-size: 12px; color: var(--color-muted); margin: 0 0 10px; }
.wiki-breadcrumb a { color: var(--color-muted); }
.wiki-breadcrumb a:hover { color: var(--color-primary); text-decoration: underline; }
.wiki-breadcrumb__sep { margin: 0 5px; color: #b7c0cf; }
.wiki-breadcrumb__current { color: #24364f; font-weight: 600; }
.wiki-meta-footer { padding-top: 4px; }
.wiki-main .btn[class*="wiki-action-"]::before {
  content: "";
  width: 13px;
  height: 13px;
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.9;
  -webkit-mask: var(--wiki-action-mask) center / contain no-repeat;
  mask: var(--wiki-action-mask) center / contain no-repeat;
}
.wiki-action-new { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 2h2v5h5v2H9v5H7V9H2V7h5z'/%3E%3C/svg%3E"); }
.wiki-action-import, .wiki-action-upload { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 2l4 4h-3v5H7V6H4l4-4zm-5 10h10v2H3v-2z'/%3E%3C/svg%3E"); }
.wiki-action-clear { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.3 2L2 3.3 6.7 8 2 12.7 3.3 14 8 9.3l4.7 4.7 1.3-1.3L9.3 8 14 3.3 12.7 2 8 6.7z'/%3E%3C/svg%3E"); }
.wiki-action-copy { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 1h8v10h-2V3H5V1zM3 5h8v10H3V5zm2 2v6h4V7H5z'/%3E%3C/svg%3E"); }
.wiki-action-edit { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.7 1.3l3 3L6 13H3v-3l8.7-8.7zM4.5 10.6v.9h.9l6.9-6.9-.9-.9-6.9 6.9z'/%3E%3C/svg%3E"); }
.wiki-action-archive { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3h12v3H2V3zm1 4h10v7H3V7zm4 2v2h2V9H7z'/%3E%3C/svg%3E"); }
.wiki-action-document { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 1h7l3 3v11H3V1zm6 1.5V5h2.5L9 2.5zM5 8h6v1.5H5V8zm0 3h6v1.5H5V11z'/%3E%3C/svg%3E"); }
.wiki-action-save { --wiki-action-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2h10l2 2v10H2V2zm2 2v3h7V4H4zm1 6v2h6v-2H5z'/%3E%3C/svg%3E"); }
.wiki-link-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.wiki-link-picker .label-chip a { color: inherit; }
.wiki-link-add { display: flex; gap: 8px; align-items: center; }

/* ---- Wikiトップページ 見た目調整 ---- */
.wiki-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
}
.wiki-hero h1 { font-size: 21px; display: flex; align-items: center; gap: 8px; }
.wiki-hero p { color: var(--color-muted); font-size: 13px; margin: 5px 0 0; max-width: 760px; }

/* 検索されないキーワード・更新期限の通知は、白い箱を並べず色帯のバナーにして視覚的な重さを減らす */
.wiki-alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; background: #f7f9fc; border: 1px solid var(--color-border); border-left: 3px solid var(--color-border); }
.wiki-alert h3 { margin: 0 0 6px; font-size: 14px; }
.wiki-alert p.muted { margin: 0 0 8px; }
.wiki-alert ul { margin: 0; padding-left: 18px; }
.wiki-alert ul li { margin-bottom: 4px; }
.wiki-alert--warning { border-left-color: #ff991f; }
.wiki-alert--info { border-left-color: var(--color-primary); }

/* よく見られている／最近見たページ：番号付きの簡易ランキング風リスト */
.wiki-stat-card h2 { display: flex; align-items: center; gap: 6px; }
.wiki-stat-list { list-style: none; margin: 0; padding: 0; counter-reset: wiki-stat; }
.wiki-stat-list li { counter-increment: wiki-stat; display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--color-border); }
.wiki-stat-list li:last-child { border-bottom: none; }
.wiki-stat-list li::before {
  content: counter(wiki-stat);
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-bg); color: var(--color-muted); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wiki-stat-card__more { margin: 10px 0 0; font-size: 13px; text-align: right; }

/* カテゴリ管理をフォームの羅列ではなく「タグ」っぽい見た目にまとめる */
.wiki-category-chip { display: inline-flex; align-items: center; gap: 2px; background: #f7f9fc; border: 1px solid var(--color-border); border-radius: 14px; padding: 2px 4px 2px 12px; }
.wiki-category-chip input[type="text"] { border: none; background: transparent; padding: 3px 2px; width: 8em; font-size: 13px; }
.wiki-category-chip input[type="text"]:focus { outline: none; }
.wiki-category-chip button {
  border: none; background: none; color: var(--color-muted); cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; font-size: 13px; line-height: 1;
}
.wiki-category-chip button:hover { background: #ffebe6; color: var(--color-danger); }

/* カテゴリのピル（一覧テーブル・詳細ページ共通。色は名前から自動で決まる） */
.wiki-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.wiki-pill-0 { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.wiki-pill-1 { background: #ecfdf5; color: #047857; border-color: #bbf7d0; }
.wiki-pill-2 { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.wiki-pill-3 { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.wiki-pill-4 { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.wiki-pill-5 { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }

/* 一覧テーブルの微調整：行の見やすさとタグの省略表示 */
#wiki-table tbody tr:hover { background: var(--color-bg); }
#wiki-table td { vertical-align: top; }
#wiki-table td:first-child a[data-wiki-open-id] { font-weight: 700; color: #1f2f46; }
#wiki-table td:first-child a[data-wiki-open-id]:hover { color: var(--color-primary); }
#wiki-table .badge { margin: 0 3px 3px 0; }
.wiki-favorite-label {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid #ffab00;
  border-radius: 10px;
  color: #974f00;
  background: #fffae6;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.wiki-draft-label {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid #6554c0;
  border-radius: 10px;
  color: #403294;
  background: #eae6ff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.wiki-inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 20px;
  height: 20px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--color-primary);
  vertical-align: middle;
}
.wiki-inline-link:hover { background: #dbeafe; }
.wiki-tag-more { color: var(--color-muted); font-size: 12px; }
