/* =========================================================================
   FlowLog — monochrome UI (VS Code / Notion / Claude inspired)
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  /* メイン書体は DM Sans (日本語はシステムの日本語フォントへフォールバック) */
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  /* 時計・時刻・数値も DM Sans。桁が揺れないよう tabular-nums と組み合わせて使う */
  --mono: var(--font);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* light (white) */
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-hover: rgba(55, 53, 47, .06);
  --bg-active: rgba(55, 53, 47, .1);
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --border: #ebebea;
  --border-strong: #dcdcd9;
  --text: #1a1a19;
  --text-2: #5f5e5a;
  --text-3: #9b9a96;
  /* アクセント #175DE8: 塗り (白文字を載せる) は --accent、線・枠・フォーカスは --accent-line */
  --accent: #175DE8;
  --accent-fg: #ffffff;
  --accent-line: #175DE8;
  --accent-soft: rgba(23, 93, 232, .08);
  --chart: #175DE8;   /* グラフの棒 (1 系列) */
  /* 中立の強調 (トーストなど) */
  --ink: #111111;
  --ink-fg: #ffffff;
  --success: #1f8f5f;
  --danger: #d1453b;
  --danger-soft: rgba(209, 69, 59, .08);
  --ring-track: #f0f0ee;
  --sun: #d63c33;   /* 日曜: 赤系 */
  --sat: #2d6ad8;   /* 土曜: 青系 */
  --scrim: rgba(15, 15, 15, .34);
  --shadow-sm: 0 1px 2px rgba(15, 15, 15, .05);
  --shadow-md: 0 6px 18px rgba(15, 15, 15, .07), 0 1px 3px rgba(15, 15, 15, .05);
  --shadow-lg: 0 28px 70px rgba(15, 15, 15, .18), 0 6px 16px rgba(15, 15, 15, .07);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* 一段暗めのダーク (背景・面・罫線を下げ、薄い文字は読みやすさを保つため少し上げる) */
  --bg: #111111;
  --bg-soft: #171717;
  --bg-hover: rgba(255, 255, 255, .05);
  --bg-active: rgba(255, 255, 255, .085);
  --surface: #161616;
  --surface-2: #1a1a1a;
  --border: #252525;
  --border-strong: #333333;
  --text: #ededeb;
  --text-2: #a3a39f;
  --text-3: #75756f;
  --accent: #175DE8;
  --accent-fg: #ffffff;
  --accent-line: #6E9BF2;   /* 暗い背景でも見やすい同系色 (#161616 に対して約 6.5:1) */
  --accent-soft: rgba(110, 155, 242, .14);
  --chart: #5B8DEE;   /* ダークの面で明度が揃う同系色 */
  --ink: #f1f1ef;
  --ink-fg: #111111;
  --success: #4cc38a;
  --danger: #f0675c;
  --danger-soft: rgba(240, 103, 92, .1);
  --ring-track: #222222;
  --sun: #f0776d;
  --sat: #6fa3ff;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .55), 0 6px 16px rgba(0, 0, 0, .35);
}

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  /* フッターを短いページでも画面の一番下に置くため縦の flex */
  display: flex; flex-direction: column;
  font: 14px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent); color: var(--accent-fg); }

/* テーマ切替のフォールバック (View Transitions 非対応ブラウザ) */
.theme-anim, .theme-anim * {
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease) !important;
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* View Transition のオーバーレイはクリックを奪うので素通しにする
   → アニメーション中でも下のボタン・カレンダーなどを操作できる */
::view-transition,
::view-transition-group(*),
::view-transition-image-pair(*),
::view-transition-old(*),
::view-transition-new(*) { pointer-events: none; }

/* テーマ切替 (View Transition) 中の軽量化
   - 新しい画面はライブ描画なので、色の transition が動くと毎フレーム再描画になる
     → transition は transform/opacity だけに絞る
     (CSS アニメは止めない: 切替中に操作して開いた画面やモーダルの登場アニメを止めないため)
   - 全画面の backdrop-filter (モーダル背景・ヘッダー) は円の範囲が変わるたびに再計算され最も重い
     → 切替中だけ外し、終了後にフェードで戻す */
.vt-theme *, .vt-theme *::before, .vt-theme *::after {
  transition-property: transform, opacity !important;
}
.vt-theme .modal-backdrop, .vt-theme .app-header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* scrollbar (VS Code ライク) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------------ icons */
.i {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.i.fill { fill: currentColor; stroke: none; }

/* 固定幅の数字 (JS の setDigits)。DM Sans は等幅数字が無いので 1 桁ずつ箱に入れて揺れを防ぐ */
.dg { display: inline-block; width: .64em; text-align: center; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s,
              box-shadow .2s var(--ease), transform .2s var(--spring);
}
.btn:active:not(:disabled) { transform: scale(.95); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .chip-btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger) !important; color: #fff !important; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2);
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s, transform .2s var(--spring);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.icon-btn .i { width: 18px; height: 18px; }

.plus-icon { transition: transform .35s var(--spring); }
.btn:hover .plus-icon { transform: rotate(90deg); }
.settings-btn .i { transition: transform .6s var(--ease); }
.settings-btn:hover .i { transform: rotate(90deg); }

/* ----------------------------------------------------------------- header */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: backdrop-filter .35s var(--ease), -webkit-backdrop-filter .35s var(--ease);
}
.header-left, .header-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: -.01em;
  transition: background-color .15s;
}
.brand:hover { background: var(--bg-hover); }
.brand-mark { width: 20px; height: 20px; transition: transform .8s var(--spring); }
/* ワードマーク: Flow を太く、Log を細く (ブランドカード準拠) */
.brand-name { font-size: 15px; letter-spacing: -.03em; }
.bn-flow { font-weight: 700; }
.bn-log { font-weight: 400; }
.brand:hover .brand-mark { transform: rotate(360deg); }
.crumb-sep { color: var(--text-3); }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; font-size: 13px; color: var(--text-2); }
.crumbs .current { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumbs a, .crumbs .sep { flex: none; white-space: nowrap; }
.crumbs a { color: inherit; text-decoration: none; padding: 3px 6px; border-radius: 4px; transition: background-color .15s, color .15s; }
.crumbs a:hover { background: var(--bg-hover); color: var(--text); }
.crumbs .current { color: var(--text); font-weight: 500; padding: 3px 6px; animation: fade-right .35s var(--ease) both; white-space: nowrap; }
.crumbs .sep { color: var(--text-3); }

.run-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; max-width: 280px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; cursor: pointer;
  animation: pill-in .45s var(--spring) both;
  transition: background-color .15s, transform .2s var(--spring);
}
.run-pill:hover { background: var(--bg-hover); }
.run-pill:active { transform: scale(.95); }
.run-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse-dot 1.6s ease-in-out infinite; }
.run-pill.paused .run-dot { background: var(--text-3); animation: none; }
.run-time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.run-title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------------- layout */
.app-main { width: 100%; max-width: 1240px; flex: 1 0 auto; margin: 0 auto; padding: 28px 24px 64px; transition: padding-left .3s var(--ease); }
/* 日の画面は横幅いっぱい: 左の日付リストの分だけ右へずらす */
.app-main.wide { max-width: none; padding-left: calc(var(--rail-space, 0px) + 28px); padding-right: 28px; }
/* 右下に小さく薄く © 表記 */
html.in-day .app-footer { right: calc(var(--side-w) + 16px); }
html.in-day.side-off .app-footer { right: 50px; }
@media (max-width: 960px) { html.in-day .app-footer { right: 16px; } }
html:not(.in-day) #daySide, html:not(.in-day) #sideOpen { display: none !important; }
.app-footer {
  position: fixed; right: 16px; bottom: 10px; z-index: 1;
  font-size: 11px; letter-spacing: .02em; color: var(--text-3); opacity: .7;
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
.view-enter { animation: view-in .45s var(--ease) both; }
.page-title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.section-label {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--text-3);
  letter-spacing: .04em; text-transform: uppercase;
}
.section-label .count { font-weight: 500; letter-spacing: 0; text-transform: none; }

/* --------------------------------------------------------------- calendar */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cal-toolbar .page-title { animation: fade-up .4s var(--ease) both; }
.cal-nav { display: flex; align-items: center; gap: 4px; }

.cal {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.cal-weekdays span { padding: 8px 10px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(120px, auto);
  gap: 1px; background: var(--border);
}
/* 画面に収まらないときは比率を保って縮小 (JS が --cal-scale と --cal-fit-w を設定)。
   枠とマス目は縮小後の大きさでレイアウト (区切り線は 1px のまま)、マスの中身と曜日は zoom で同じ倍率に */
html.in-cal .app-main { padding-bottom: 20px; }
/* ホーム (ウィジェットのボード) は画面の横幅いっぱいに */
@media (min-width: 641px) { html.in-cal .app-main { max-width: none; padding-left: 28px; padding-right: 28px; } }
.cal-grid.anim-next { animation: slide-from-right .4s var(--ease) both; }
.cal-grid.anim-prev { animation: slide-from-left .4s var(--ease) both; }

.cal-cell {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 6px 6px 8px; background: var(--surface); cursor: pointer; outline: none;
  transition: background-color .18s;
}
.cal-cell:hover, .cal-cell:focus-visible { background: var(--surface-2); }
.cal-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-line); }
.cal-cell.is-out { background: var(--bg-soft); }
.cal-cell.is-out .cal-num { color: var(--text-3); }
.cal-cell-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 26px; }
.cal-num {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 999px; font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background-color .2s, color .2s, transform .3s var(--spring);
}
.cal-num small { font-size: 11px; color: var(--text-3); margin-left: 2px; font-weight: 400; }
.cal-cell:hover .cal-num { transform: scale(1.08); }
.cal-cell.is-today .cal-num { background: var(--accent); color: var(--accent-fg); animation: pop .5s var(--spring) .2s both; }
.cal-cell.is-today .cal-num small { color: inherit; opacity: .7; }
/* 土日: 数字を色付け + セルにごく薄い色味 */
.cal-weekdays span:first-child { color: var(--sun); }
.cal-weekdays span:last-child { color: var(--sat); }
.cal-cell.is-sun { background: color-mix(in srgb, var(--sun) 3.5%, var(--surface)); }
.cal-cell.is-sat { background: color-mix(in srgb, var(--sat) 3.5%, var(--surface)); }
.cal-cell.is-sun:hover, .cal-cell.is-sun:focus-visible { background: color-mix(in srgb, var(--sun) 7%, var(--surface)); }
.cal-cell.is-sat:hover, .cal-cell.is-sat:focus-visible { background: color-mix(in srgb, var(--sat) 7%, var(--surface)); }
.cal-cell.is-out.is-sun { background: color-mix(in srgb, var(--sun) 3.5%, var(--bg-soft)); }
.cal-cell.is-out.is-sat { background: color-mix(in srgb, var(--sat) 3.5%, var(--bg-soft)); }
.cal-cell.is-sun .cal-num { color: var(--sun); }
.cal-cell.is-sat .cal-num { color: var(--sat); }
.cal-cell.is-out.is-sun .cal-num { color: color-mix(in srgb, var(--sun) 55%, var(--surface)); }
.cal-cell.is-out.is-sat .cal-num { color: color-mix(in srgb, var(--sat) 55%, var(--surface)); }
/* 今日が土日なら丸をその色に */
.cal-cell.is-today.is-sun .cal-num { background: var(--sun); color: var(--surface); }
.cal-cell.is-today.is-sat .cal-num { background: var(--sat); color: var(--surface); }
/* 日画面のタイトル・ホバーポップの日付 */
.is-sun-text { color: var(--sun); }
.is-sat-text { color: var(--sat); }

.cal-add {
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--text-2); cursor: pointer;
  opacity: 0; transform: scale(.6);
  transition: opacity .18s, transform .25s var(--spring), background-color .15s;
}
.cal-add .i { width: 14px; height: 14px; }
.cal-cell:hover .cal-add { opacity: 1; transform: none; }
.cal-add:hover { background: var(--bg-active); color: var(--text); }

.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chip {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-soft); border: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.5;
  transition: border-color .15s, transform .2s var(--ease);
}
.cal-cell:hover .chip { border-color: var(--border-strong); }
.chip-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); flex: none; }
.chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-done .chip-title { color: var(--text-3); text-decoration: line-through; }
.chip.is-done::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--success); flex: none; }
.chip-more { padding: 0 6px; font-size: 11px; color: var(--text-3); }

/* --------------------------------------------------------------- projects */
.proj-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; max-width: 240px; padding: 0 8px 0 5px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color .15s;
}
.proj-btn:hover, .proj-btn[aria-expanded="true"] { background: var(--bg-hover); }
.proj-icon {
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 5px;
  background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 700; line-height: 1;
}
/* アイコンの文字は枠からはみ出さない (2 文字は少し小さく) */
.proj-icon { overflow: hidden; }
.proj-icon .pi-t { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: clip; letter-spacing: -.02em; }
.proj-icon .pi-t.is-2 { font-size: .74em; letter-spacing: -.04em; }
.proj-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-icon .i { width: 12px; height: 12px; stroke-width: 2.4; }
.proj-icon.is-private { background: var(--ink); color: var(--ink-fg); }
/* 色を設定したアイコン: タグと同じパレットの淡い地に濃い文字 (ライト/ダークとも読める) */
.proj-icon[data-c] { background: color-mix(in srgb, var(--tag) 24%, var(--surface)); color: color-mix(in srgb, var(--tag) 85%, var(--text)); }
.proj-icon.lg { width: 40px; height: 40px; border-radius: 10px; font-size: 19px; }
.proj-icon.lg .i { width: 20px; height: 20px; }
.proj-icon.xl { width: 64px; height: 64px; border-radius: 16px; font-size: 30px; }
.proj-icon.xl .i { width: 30px; height: 30px; }
/* アップロードした画像のアイコン */
.proj-icon.has-img { overflow: hidden; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); }
.proj-icon.has-img img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------- project settings */
.ps-view { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
/* サイドバー + 本文 */
.ps-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.ps-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; animation: fade-right .4s var(--ease) both; }
.ps-nav-item {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: color .2s, background-color .15s;
}
.ps-nav-item .i { width: 16px; height: 16px; flex: none; transition: transform .3s var(--spring); }
.ps-nav-item:hover { color: var(--text); background: var(--bg-hover); }
.ps-nav-item:hover .i { transform: scale(1.1); }
.ps-nav-item.is-active { color: var(--text); font-weight: 600; background: transparent; }
.ps-nav-item.is-active .i { color: var(--accent); }
.ps-nav-count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* 選択中の印: 位置と大きさを JS が渡し、すべるように移動 */
.ps-nav-ind {
  position: absolute; top: 0; left: 0; width: var(--w, 0); height: var(--h, 0); border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transform: translate(var(--x, 0), var(--y, 0)); transition: transform .4s var(--spring), width .3s var(--ease), height .3s var(--ease);
}
.ps-nav-ind::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ps-panels { min-width: 0; }

/* ------------------------------------------------------------- admin */
.ad-panel { display: flex; flex-direction: column; gap: 18px; }
.ad-panel[hidden] { display: none; }
.ad-head-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--ink-fg); animation: pop .45s var(--spring); }
.ad-head-icon .i { width: 20px; height: 20px; }
.ad-loading { color: var(--text-3); font-size: 13px; }
.ad-status-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: color-mix(in srgb, var(--success) 85%, var(--text));
}
.ad-pill.err { background: var(--danger-soft); color: var(--danger); }
.ad-pill .i { width: 16px; height: 16px; stroke-width: 2.2; }
.ad-pill.ok .i { animation: pop .5s var(--spring); }
.ad-checked { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ad-refresh .i { width: 14px; height: 14px; }
.ad-refresh.spin-once .i { animation: spin .6s var(--ease); }
.ad-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin: 16px 0 0; }
.ad-facts dt { font-size: 11.5px; color: var(--text-3); }
.ad-facts dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ad-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ad-tile {
  display: flex; flex-direction: column; gap: 1px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm); animation: fade-up .4s var(--ease) both; animation-delay: calc(var(--i) * 40ms);
}
.ad-tile .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ad-tile .k { font-size: 12.5px; color: var(--text-2); }
.ad-tile .s { font-size: 11.5px; color: var(--text-3); }
/* グラフ */
.ad-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.ad-chart-head .ps-card-title { margin-bottom: 12px; }
.ad-chart-sub { font-size: 12px; font-weight: 500; color: var(--text-3); }
.ad-chart-sum { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ad-chart { display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: 180px auto; column-gap: 8px; }
.ad-yaxis { position: relative; }
.ad-yaxis span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ad-plot { position: relative; border-bottom: 1px solid var(--border-strong); }
.ad-gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--border); }
.ad-bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; }
.ad-bar { display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0; border: 0; border-radius: 6px 6px 0 0; background: transparent; cursor: default; outline: none; transition: background-color .15s; }
.ad-bar:hover, .ad-bar:focus-visible { background: var(--bg-hover); }
.ad-bar:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-line); }
.ad-bar span { display: block; width: min(60%, 22px); border-radius: 4px 4px 0 0; background: var(--chart); transform-origin: bottom; animation: bar-grow .6s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: none; } }
.ad-xaxis { grid-column: 2; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; margin-top: 6px; font-size: 11px; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.ad-xaxis .is-today { color: var(--text); font-weight: 700; }
.ad-tip {
  position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 8px)); display: flex; flex-direction: column; gap: 1px;
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-md);
  font-size: 12px; white-space: nowrap; pointer-events: none; animation: tip-in .16s var(--ease);
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, calc(-100% - 3px)); } to { opacity: 1; transform: translate(-50%, calc(-100% - 8px)); } }
.ad-tip b { margin-bottom: 2px; font-size: 12.5px; }
.ad-tip span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.ad-table { margin-top: 14px; font-size: 12.5px; }
.ad-table summary { cursor: pointer; color: var(--text-2); width: fit-content; }
.ad-table summary:hover { color: var(--text); }
.ad-table-wrap { overflow-x: auto; margin-top: 8px; }
.ad-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ad-table th, .ad-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.ad-table th:first-child, .ad-table td:first-child { text-align: left; }
.ad-table th { font-weight: 600; color: var(--text-3); font-size: 11.5px; }
.ad-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ad-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ad-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); }
.ad-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.ad-row-col { flex-direction: column; gap: 6px; }
.ad-row-top { display: flex; justify-content: space-between; }
.ad-row-sub { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); }
.ad-row-sub .i { width: 13px; height: 13px; color: var(--danger); }
.ad-meter { display: block; height: 8px; border-radius: 999px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.ad-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--chart); transform-origin: left; animation: meter-in .8s var(--ease) both; }
.ad-meter.warn > span { background: var(--danger); }
@keyframes meter-in { from { transform: scaleX(0); } to { transform: none; } }
.ad-logins { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ad-logins li { display: flex; align-items: center; gap: 10px; animation: fade-right .35s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }
.ad-logins .avatar { width: 28px; height: 28px; font-size: 12px; }
.ad-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* ユーザー */
.ad-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ad-form.shake { animation: shake .4s var(--ease); }
.ad-form-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ad-form-foot .spacer { flex: 1; }
.ad-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.ad-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ad-mail-note { margin: 12px 0 0; }
.ad-user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ad-user { border-radius: 10px; animation: fade-right .35s var(--ease) both; animation-delay: calc(var(--i) * 30ms); transition: background-color .2s; }
.ad-user.is-editing { background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--border); }
.ad-user.removing { animation: record-out .3s var(--ease) forwards; }
.ad-user.ad-new { animation: ad-new 1.2s var(--ease); }
@keyframes ad-new { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.ad-user-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; transition: background-color .15s; }
.ad-user:not(.is-editing) .ad-user-row:hover { background: var(--bg-hover); }
.ad-user .avatar { width: 34px; height: 34px; font-size: 14px; flex: none; }
.ad-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ad-who .am-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-badge { margin-left: 4px; padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-line); font-size: 10.5px; font-weight: 600; }
.ad-noemail { color: var(--danger); }
.ad-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 11.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ad-del-spacer { width: 64px; flex: none; }
.ad-user .ps-remove { min-width: 64px; }
.ad-edit { padding: 2px 14px 14px 54px; animation: fade-up .3s var(--ease) both; }
.ad-edit .field:nth-child(3) { grid-column: 1 / -1; }
/* アカウント設定 */
.prof-body { display: flex; flex-direction: column; gap: 14px; }
.prof-who { display: flex; align-items: center; gap: 12px; }
.prof-sep { height: 1px; background: var(--border); }
@media (max-width: 960px) { .ad-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ad-two { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .ad-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-form { grid-template-columns: 1fr; }
  .ad-edit { padding-left: 14px; }
  .ad-meta { display: none; }
  .ad-chart { grid-template-columns: 40px minmax(0, 1fr); }
}
.ps-panel-in { animation: ps-panel-in .35s var(--ease) both; }
@keyframes ps-panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ps-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.ps-card {
  padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-sm); animation: fade-up .45s var(--ease) both;
}
.ps-card + .ps-card { animation-delay: .06s; }
.ps-card.shake { animation: shake .4s var(--ease); }
.ps-card-title { margin: 0 0 14px; font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.ps-count { padding: 0 7px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.ps-note { margin: -6px 0 14px; font-size: 12.5px; color: var(--text-3); }
.ps-general { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: start; }
.ps-preview {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 12px 16px;
  border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--bg-soft); text-align: center;
  transition: border-color .2s, background-color .2s;
}
.ps-preview-icon { display: grid; place-items: center; }
.ps-preview-icon.pop-in .proj-icon { animation: pop .45s var(--spring); }
.ps-icon-actions { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; margin-top: 4px; }
.ps-icon-actions .btn { justify-content: center; }
.ps-icon-actions .i { width: 15px; height: 15px; }
.ps-hint { font-size: 11px; line-height: 1.5; color: var(--text-3); }
.ps-drop {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); opacity: 0; transition: opacity .2s;
}
.ps-drop .i { width: 30px; height: 30px; animation: float 1.2s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(2px); } to { transform: translateY(-4px); } }
.ps-preview.is-drag { border-color: var(--accent); }
.ps-preview.is-drag .ps-drop { opacity: 1; }
.ps-preview.is-uploading .ps-preview-icon { animation: blink 1s ease-in-out infinite; }
.ps-sub { display: block; margin: -2px 0 8px; font-size: 12px; color: var(--text-3); }
.ps-fallback { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ps-fallback input { flex: 1; min-width: 0; }
.ps-start { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ps-start input { width: auto; flex: 1 1 140px; min-width: 0; }
/* 権限 */
.ps-perm { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--border); }
.ps-perm:first-of-type { border-top: 0; padding-top: 4px; }
.ps-perm .segmented { min-width: 240px; }
.ps-perm .segmented.is-disabled { opacity: .6; }
.ps-perm .segmented button:disabled { cursor: not-allowed; }
.ps-perm-foot {
  display: flex; gap: 8px; margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bg-soft);
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
}
.ps-perm-foot .i { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--text-3); }
.ps-invite-note { margin: 0 0 12px; }
/* タグ */
.ps-tag-list { max-height: none; }
.tm-row.removing { animation: record-out .3s var(--ease) forwards; pointer-events: none; }
.tm-color:disabled { cursor: default; transform: none; }
.tm-name[readonly] { cursor: default; }
.tm-name[readonly]:hover { border-color: transparent; }
/* カレンダー: プロジェクトの開始日 */
.cal-start {
  display: inline-flex; align-items: center; gap: 3px; min-width: 0; margin-right: auto; padding: 1px 6px 1px 4px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 650;
  white-space: nowrap; animation: pop .45s var(--spring) both;
}
.cal-start .i { width: 11px; height: 11px; stroke-width: 2.4; }
.cal-start .proj-icon.xs { width: 13px; height: 13px; font-size: 8px; }
.ps-preview .proj-icon { animation: pop .4s var(--spring); }
.ps-preview-name { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.ps-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ps-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-swatch {
  width: 26px; height: 26px; padding: 0; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; background: var(--accent);
  box-shadow: 0 0 0 1px var(--border); transition: transform .25s var(--spring), border-color .15s, box-shadow .15s;
}
.ps-swatch[data-c] { background: var(--tag); }
.ps-swatch:hover:not(:disabled) { transform: scale(1.12); }
.ps-swatch.is-on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }
.ps-swatch.tm-pop { animation: pop .4s var(--spring); }
.ps-swatch:disabled { cursor: not-allowed; opacity: .55; }
.ps-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.ps-invite { display: flex; gap: 8px; margin-bottom: 14px; }
.ps-invite input, .ps-invite select, .ps-role {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .2s;
}
.ps-invite input { flex: 1; min-width: 0; }
.ps-invite input:focus, .ps-invite select:focus, .ps-role:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ps-invite input.shake, .ps-invite.shake { animation: shake .4s var(--ease); }
.ps-member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ps-member {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 8px;
  animation: fade-right .35s var(--ease) both; animation-delay: calc(var(--i) * 30ms); transition: background-color .15s;
}
.ps-member:hover { background: var(--bg-hover); }
.ps-member .avatar { width: 30px; height: 30px; font-size: 13px; }
.ps-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ps-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-you { margin-left: 4px; padding: 0 6px; border-radius: 4px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 10.5px; font-weight: 600; color: var(--text-2); }
.ps-role { width: 112px; height: 30px; font-size: 12.5px; }
.ps-role-text { width: 112px; }
.ps-remove, .ps-leave { min-width: 64px; }
.ps-role-text { font-size: 12px; color: var(--text-3); }
.ps-remove:hover, .ps-leave:hover { color: var(--danger); background: var(--danger-soft); }
@media (max-width: 820px) {
  .ps-layout { grid-template-columns: 1fr; gap: 14px; }
  .ps-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .ps-nav-item { flex: none; }
  .ps-nav-ind::before { left: 10px; right: 10px; top: auto; bottom: -1px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
}
@media (max-width: 640px) {
  .ps-general { grid-template-columns: 1fr; }
  .ps-invite { flex-wrap: wrap; }
  .ps-perm { flex-direction: column; align-items: stretch; }
}
.proj-icon.xs { width: 15px; height: 15px; border-radius: 4px; font-size: 9px; }
.proj-icon.xs .i { width: 9px; height: 9px; }
.chip .proj-icon.xs { flex: none; }
.proj-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 160px; padding: 1px 8px 1px 3px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-soft);
  font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pop-proj { margin-top: 3px; }
.record-time .proj-icon.xs { vertical-align: -3px; margin-left: 4px; }
.pm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pm-desc { font-size: 11px; font-weight: 400; color: var(--text-3); white-space: normal; line-height: 1.35; }
.pm-group { padding: 10px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-3); list-style: none; }
.field select {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .2s var(--ease);
}
.field select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.proj-caret { width: 14px; height: 14px; color: var(--text-3); transition: transform .25s var(--spring); }
.proj-btn[aria-expanded="true"] .proj-caret { transform: rotate(180deg); }

.proj-menu {
  position: fixed; z-index: 45; width: 280px; padding: 6px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top left;
  transition: opacity .15s var(--ease), transform .2s var(--ease);
}
.proj-menu.open { opacity: 1; transform: none; transition: opacity .2s var(--ease), transform .35s var(--spring); }
.pm-label { padding: 6px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; }
.pm-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.pm-item, .pm-action {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
  transition: background-color .12s;
}
.pm-item:hover, .pm-action:hover { background: var(--bg-hover); }
.pm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-count { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.pm-role {
  padding: 1px 6px; border-radius: 4px; font-size: 10.5px; font-weight: 600; white-space: nowrap;
  color: var(--accent-line); background: var(--accent-soft);
}
.am-user { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.pm-action.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ------------------------------------------------------------------ login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; box-sizing: border-box; }
.login-card {
  width: min(380px, 100%); padding: 32px 28px 26px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md);
  animation: fade-up .5s var(--ease) both;
}
.login-card.shake { animation: shake .4s var(--ease); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand svg { width: 30px; height: 30px; color: var(--text); }
.login-brand .brand-name { font-size: 22px; }
.login-title { margin: 0 0 4px; font-size: 18px; font-weight: 650; }
.login-sub { margin: 0 0 20px; font-size: 13px; color: var(--text-3); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .field > * { animation: fade-up .45s var(--ease) both; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3); cursor: pointer; transition: color .15s, background-color .15s;
}
.pw-toggle:hover { color: var(--text); background: var(--bg-hover); }
.pw-toggle .i { width: 16px; height: 16px; }
.login-error {
  min-height: 18px; margin: -4px 0 0; font-size: 12.5px; color: var(--danger);
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s var(--ease);
}
.login-error.show { opacity: 1; transform: none; }
.login-btn { height: 40px; font-size: 14px; }
.login-btn .spin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: none;
}
.login-btn.loading .spin { display: inline-block; }
.login-btn.loading .label { opacity: .7; }
.login-foot { margin-top: 18px; text-align: center; font-size: 11px; color: var(--text-3); }
.pm-check { width: 15px; height: 15px; color: var(--accent-line); opacity: 0; }
.pm-item.is-current { font-weight: 600; }
.pm-item.is-current .pm-check { opacity: 1; }
.pm-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.pm-action { color: var(--text-2); }
.pm-action .i { width: 15px; height: 15px; }
.pm-form { display: flex; gap: 6px; padding: 2px 2px 4px; }
.pm-form input {
  flex: 1; min-width: 0; height: 30px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .2s;
}
.pm-form input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.pm-form input.shake { animation: shake .4s var(--ease); }
@media (max-width: 640px) { .proj-name { display: none; } }

/* ---------------------------------------------------------------- account */
.account-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; max-width: 200px; padding: 0 12px 0 4px; margin-left: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .2s var(--spring);
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--bg-hover); border-color: var(--border-strong); }
.account-btn:active { transform: scale(.96); }
.avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; line-height: 1;
}
.avatar-lg { width: 36px; height: 36px; font-size: 16px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ヘッダーが狭いとき: ボタン類は縮めず、長い名前 (アカウント・プロジェクト) を省略して縮める */
.header-right > * { flex-shrink: 0; }
.header-right > .account-btn { flex-shrink: 1; min-width: 36px; }
.header-left .proj-btn { min-width: 0; flex-shrink: 4; } /* 先にプロジェクト名を縮めて、パンくずを残す */
.acct-menu {
  position: fixed; z-index: 45; width: 260px; padding: 6px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .15s var(--ease), transform .2s var(--ease);
}
.acct-menu.open { opacity: 1; transform: none; transition: opacity .2s var(--ease), transform .35s var(--spring); }
.am-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 6px; }
.am-who { min-width: 0; }
.am-name { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-note { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 640px) { .account-name { display: none; } .account-btn { padding: 0 3px; } }

/* --------------------------------------------- day rail (日画面の左の日付リスト) */
/* 左端に密着したサイドバー: ヘッダーの下から画面の下まで、右側だけ罫線 */
.day-rail {
  position: fixed; z-index: 20; left: 0; top: 52px; bottom: 0;
  width: var(--rail-w, 220px);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  transform: translateX(-100%);
  transition: transform .3s var(--ease), width .3s var(--ease);
}
/* 壁から滑り出す (オーバーシュートすると壁から離れて見えるので spring は使わない) */
.day-rail.show { transform: none; transition: transform .5s cubic-bezier(.16, 1, .3, 1), width .3s var(--ease); }
.rail-head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  height: 44px; flex: none; padding: 0 6px 0 14px; border-bottom: 1px solid var(--border);
}
.rail-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* 今日が範囲の外に出たときだけ出る「今日」ボタン */
.rail-today {
  flex: none; height: 22px; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--accent-line) 30%, var(--border)); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-line); font: inherit; font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer;
  transition: background-color .15s, transform .2s var(--spring);
  animation: pop .4s var(--spring) both;
}
.rail-today:hover { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.rail-today:active { transform: scale(.94); }
.day-rail[data-mode="mini"] .rail-title { gap: 3px; }
.day-rail[data-mode="mini"] .rail-today { padding: 0 5px; font-size: 10.5px; }
/* 一番狭い表示では、ボタンが出ている間は月の表示を隠す (幅が足りないので) */
.day-rail[data-mode="mini"].away-from-today .rail-month { display: none; }
.rail-month { font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.rail-close { width: 28px; height: 28px; flex: none; }
.rail-close .i { width: 16px; height: 16px; }
.rail-shift {
  display: grid; place-items: center; height: 32px; flex: none; padding: 0;
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.rail-shift:hover { color: var(--text); background: var(--bg-hover); }
.rail-shift:active .i { transform: scale(.85); }
.rail-shift .i { transition: transform .3s var(--spring); }
#railUp:hover .i { transform: translateY(-2px); }
#railDown:hover .i { transform: translateY(2px); }
.rail-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; padding: 2px 6px 0; }
.rail-track { position: relative; }
.rail-track.enter .rail-list > li { animation: fade-right .45s var(--ease) both; animation-delay: calc(120ms + var(--i) * 22ms); }
.rail-list { position: relative; list-style: none; margin: 0; padding: 0; }
.rail-sel {
  position: absolute; left: 0; right: 0; top: 0; height: 52px;
  border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent-line) 35%, transparent);
  pointer-events: none;
}

.rail-day {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; column-gap: 8px;
  height: 52px; margin-bottom: 4px; padding: 4px 8px; box-sizing: border-box;
  border-radius: 10px; color: var(--text); text-decoration: none; outline: none;
  transition: background-color .15s;
}
.rail-day:hover { background: var(--bg-hover); }
.rail-day:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-line); }
.rail-day:active { transform: scale(.98); }
.rd-date { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.1; }
.rd-wd { font-size: 10.5px; color: var(--text-3); }
.rd-num {
  display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.rail-day.is-sel .rd-num { font-weight: 700; }
.rail-day.is-sun .rd-wd, .rail-day.is-sun .rd-num { color: var(--sun); }
.rail-day.is-sat .rd-wd, .rail-day.is-sat .rd-num { color: var(--sat); }
.rail-day.is-today .rd-num { background: var(--accent); color: var(--accent-fg); }
.rail-day.is-today.is-sun .rd-num { background: var(--sun); color: var(--surface); }
.rail-day.is-today.is-sat .rd-num { background: var(--sat); color: var(--surface); }
.rd-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.rd-first { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.rd-none { font-size: 11.5px; color: var(--text-3); }
.rd-bar { position: absolute; left: 50px; right: 10px; bottom: 5px; height: 2px; border-radius: 2px; background: var(--border); overflow: hidden; }
.rd-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .6s var(--ease); }
.rail-day.is-empty .rd-bar { display: none; }
.rd-dots { display: none; }
.rail-day.is-live::after {
  content: ""; position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); animation: pulse-dot 1.6s ease-in-out infinite;
}
/* compact: 件数だけ / mini: 日付とドットだけ */
.day-rail[data-mode="compact"] .rd-first { display: none; }
.day-rail[data-mode="mini"] .rail-head { padding: 0 4px 0 10px; }
.day-rail[data-mode="mini"] .rail-wrap { padding: 2px 4px 0; }
.day-rail[data-mode="mini"] .rail-day { grid-template-columns: 1fr; justify-items: center; padding: 3px 2px; }
.day-rail[data-mode="mini"] .rd-body,
.day-rail[data-mode="mini"] .rd-bar { display: none; }
.day-rail[data-mode="mini"] .rd-dots { display: flex; gap: 3px; height: 4px; margin-top: 2px; }
.rd-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }
.rd-dots i.d { background: var(--success); }
.day-rail[data-mode="mini"] .rd-date { flex-direction: row; gap: 3px; }

.rail-open {
  position: fixed; z-index: 20; left: 0; top: 68px;
  display: grid; place-items: center; width: 34px; height: 40px; padding: 0;
  border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 10px 10px 0;
  background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-sm); cursor: pointer;
  animation: fade-right .35s var(--ease) both;
  transition: background-color .15s, color .15s, transform .25s var(--spring);
}
.rail-open:hover { background: var(--bg-hover); color: var(--text); }
.rail-open:active { transform: scale(.92); }
.rail-open .i { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ tags */
/* 色はキーで持ち、ライト/ダークで見やすい値に切り替える */
[data-c="gray"]   { --tag: #6b6b68; }
[data-c="red"]    { --tag: #d63c33; }
[data-c="orange"] { --tag: #d9730d; }
[data-c="yellow"] { --tag: #b08800; }
[data-c="green"]  { --tag: #1f8f5f; }
[data-c="teal"]   { --tag: #0f8b8d; }
[data-c="blue"]   { --tag: #2d6ad8; }
[data-c="purple"] { --tag: #7c3aed; }
[data-c="pink"]   { --tag: #c4387a; }
:root[data-theme="dark"] [data-c="gray"]   { --tag: #9a9a96; }
:root[data-theme="dark"] [data-c="red"]    { --tag: #f0776d; }
:root[data-theme="dark"] [data-c="orange"] { --tag: #f0a050; }
:root[data-theme="dark"] [data-c="yellow"] { --tag: #e2c044; }
:root[data-theme="dark"] [data-c="green"]  { --tag: #4cc38a; }
:root[data-theme="dark"] [data-c="teal"]   { --tag: #3cc0c0; }
:root[data-theme="dark"] [data-c="blue"]   { --tag: #6fa3ff; }
:root[data-theme="dark"] [data-c="purple"] { --tag: #a98bff; }
:root[data-theme="dark"] [data-c="pink"]   { --tag: #f07ab0; }

.tag-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.tag-list:empty { display: none; }
/* タグは「荷札」の形: 左端は三角、名前の前に点 (穴)、右端は角ばった四角。
   丸いピル型の状態バッジ (完了 / Done など) と見分けがつくように */
.tag {
  display: inline-flex; align-items: center; gap: 5px; max-width: 180px; height: 20px;
  padding: 0 8px 0 13px; box-sizing: border-box;
  border-radius: 0 3px 3px 0;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%);
  background: color-mix(in srgb, var(--tag, #6b6b68) 17%, var(--surface));
  color: color-mix(in srgb, var(--tag, #6b6b68) 78%, var(--text));
  font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag::before {
  content: ""; width: 5px; height: 5px; flex: none; border-radius: 50%;
  background: currentColor; opacity: .85;
}
.timer-tags { margin-top: 8px; }
.fc-tags { margin-top: -6px; }
.pop-tags { margin-top: 3px; }
.pop-tags .tag { font-size: 10.5px; height: 18px; padding: 0 6px 0 11px; clip-path: polygon(7px 0, 100% 0, 100% 100%, 7px 100%, 0 50%); }
.pop-tags .tag::before { width: 4px; height: 4px; }

/* タスク編集: タグ入力 */
/* 登場アニメ (fill: both) で各欄が重なり順を持つため、候補リストが下の欄に隠れないよう前面に */
.tag-field { position: relative; z-index: 6; }
.tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); cursor: text;
  transition: border-color .15s, box-shadow .2s var(--ease);
}
.tag-input:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-input-chips { display: contents; }
.tag-input-chips .tag { padding-right: 3px; animation: pop .35s var(--spring); }
/* .field input の枠・フォーカスリングを打ち消す (外側の .tag-input が枠を持つ) */
.tag-field .tag-input input,
.tag-field .tag-input input:focus {
  flex: 1; width: auto; min-width: 120px; height: 26px; padding: 0; border: 0; outline: none; box-shadow: none;
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px;
}
.tag-x {
  display: grid; place-items: center; width: 16px; height: 16px; padding: 0; margin-left: 2px;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; opacity: .65;
  transition: opacity .15s, background-color .15s, transform .2s var(--spring);
}
.tag-x:hover { opacity: 1; background: color-mix(in srgb, var(--tag) 22%, transparent); }
.tag-x:active { transform: scale(.85); }
.tag-x .i { width: 11px; height: 11px; stroke-width: 2.5; }
.tag-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  max-height: 232px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-lg);
  animation: fade-up .18s var(--ease);
}
.sug-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: background-color .12s;
}
.sug-item.active, .sug-item:hover { background: var(--bg-hover); }
/* 既存タグの行: 左で選択、右の × でタグそのものを削除 */
.sug-row {
  display: flex; align-items: center; border-radius: 6px;
  transition: background-color .12s, opacity .18s var(--ease), transform .18s var(--ease);
}
.sug-row.active, .sug-row:hover { background: var(--bg-hover); }
.sug-row .sug-item { flex: 1; min-width: 0; background: transparent; }
.sug-row.removing { opacity: 0; transform: translateX(10px); }
.sug-del {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none; margin-right: 3px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s, background-color .15s, transform .2s var(--spring);
}
.sug-del .i { width: 13px; height: 13px; }
.sug-row:hover .sug-del, .sug-row.active .sug-del, .sug-del:focus-visible { opacity: 1; }
.sug-del:hover { color: var(--danger); background: var(--danger-soft); }
.sug-del:active { transform: scale(.88); }
@media (hover: none) { .sug-del { opacity: 1; } } /* タッチ端末では常に表示 */
.sug-create { color: var(--accent-line); font-weight: 500; }
.sug-create .i { width: 14px; height: 14px; }
.sug-empty { padding: 8px 10px; font-size: 12.5px; color: var(--text-3); }

/* 設定: タグの管理 */
.setting.setting-col { flex-direction: column; align-items: stretch; gap: 10px; }
.tag-manager { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.tm-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 6px; border-radius: 8px; transition: background-color .15s; animation: fade-right .3s var(--ease) both; animation-delay: calc(var(--i) * 25ms); }
.tm-row:hover { background: var(--bg-hover); }
.tm-color {
  width: 16px; height: 16px; flex: none; padding: 0; border: 0; border-radius: 50%;
  background: var(--tag); cursor: pointer; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag) 18%, transparent);
  transition: transform .25s var(--spring), background-color .25s;
}
.tm-color:hover { transform: scale(1.18); }
.tm-color.tm-pop { animation: pop .4s var(--spring); }
.tm-name {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, background-color .15s;
}
.tm-name:hover { border-color: var(--border); }
.tm-name:focus { outline: none; border-color: var(--accent-line); background: var(--bg); }
.tm-count { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.tm-del { width: 28px; height: 28px; }
.tm-del:hover { color: var(--danger); background: var(--danger-soft); }
.tm-empty { padding: 6px 2px; font-size: 12.5px; color: var(--text-3); }

/* ----------------------------------------------------------- attachments */
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.attach-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.attach-btn { color: var(--text-2); margin-left: -6px; }
.attach-btn .i { width: 15px; height: 15px; transition: transform .3s var(--spring); }
.attach-btn:hover .i { transform: rotate(-12deg); }
.attach-hint { font-size: 11.5px; color: var(--text-3); }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 4px; }
.attach-grid:empty { display: none; }
.att {
  position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--border); background: var(--bg-soft);
  animation: pop .35s var(--spring); transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.att.removing { opacity: 0; transform: scale(.85); }
.att img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .3s, opacity .3s; }
.att.is-uploading img { filter: grayscale(.4) blur(1px); opacity: .55; }
.att-spin {
  position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-line) 25%, transparent); border-top-color: var(--accent-line);
  animation: spin .8s linear infinite;
}
.att-x {
  position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer;
  opacity: 0; transition: opacity .15s, transform .2s var(--spring);
}
.att-x .i { width: 12px; height: 12px; stroke-width: 2.5; }
.att:hover .att-x, .att-x:focus-visible { opacity: 1; }
.att-x:active { transform: scale(.85); }
@media (hover: none) { .att-x { opacity: 1; } }
/* ドラッグ中: モーダル全体を受け口として表示 */
.attach-drop {
  position: absolute; inset: 8px; z-index: 30; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--accent-line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--accent-line); font-size: 14px; font-weight: 600; pointer-events: none;
}
.attach-drop .i { width: 28px; height: 28px; animation: float 1.6s ease-in-out infinite; }
#taskModal .modal-panel.dragging .attach-drop { display: flex; animation: fade-up .2s var(--ease); }

/* タイムラインの画像: カードの空いている右側に、切り抜かず (縦横比のまま) 縮小して全体を見せる。
   カードが狭いときはコンテナクエリで本文の下へ回し、カード幅に収める */
.tl-card { container-type: inline-size; }
.tl-body.has-media { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; }
/* 画像の領域はカード幅の半分まで。入りきらない分は次の行へ折り返す (切り抜きはしない) */
.tl-media { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: 50cqw; }
.tl-att {
  position: relative; display: block; padding: 0; line-height: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-soft);
  transition: transform .2s var(--spring), border-color .15s, box-shadow .2s;
}
.tl-att:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
/* width/height を auto にして max だけ指定 → 縦横比を保ったまま縮むので、横幅も縦も必ず全体が映る */
.tl-att img { display: block; width: auto; height: auto; max-height: 72px; max-width: min(200px, 22cqw); }
.tl-att-badge {
  position: absolute; right: 3px; bottom: 3px; padding: 2px 6px; border-radius: 999px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.3;
}
@container (max-width: 560px) {
  .tl-body.has-media { grid-template-columns: minmax(0, 1fr); }
  .tl-media { justify-content: flex-start; margin-top: 8px; max-width: none; }
  .tl-att img { max-width: min(240px, calc(100cqw - 32px)); }
}
.pop-att { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11px; color: var(--text-3); }
.pop-att .i { width: 12px; height: 12px; }

/* 拡大表示 */
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .82); opacity: 0; transition: opacity .22s var(--ease);
}
.lightbox.open { opacity: 1; }
.lb-img {
  max-width: min(92vw, 1600px); max-height: 86vh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  transform: scale(.96); transition: transform .35s var(--spring); background: #222;
}
.lightbox.open .lb-img { transform: none; }
.lb-img.lb-swap { animation: fade-up .25s var(--ease); }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
  transition: background-color .15s, transform .2s var(--spring);
}
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-btn:active { transform: scale(.9); }
.lb-btn .i { width: 22px; height: 22px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lightbox.single .lb-nav { display: none; }
.lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: rgba(255, 255, 255, .75); font-size: 13px; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------- calendar hover popover */
.cal-pop {
  position: fixed; left: 0; top: 0; z-index: 40;
  width: 300px; max-width: calc(100vw - 16px);
  pointer-events: none; /* カーソルの邪魔をしない */
  will-change: transform;
}
.cal-pop-inner {
  max-height: calc(100vh - 16px); overflow: hidden;
  padding: 12px 12px 10px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: scale(.92); transform-origin: var(--origin, top left);
  transition: opacity .12s var(--ease), transform .15s var(--ease);
}
.cal-pop.show .cal-pop-inner {
  opacity: 1; transform: none;
  transition: opacity .2s var(--ease), transform .4s var(--spring);
}
.pop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 2px 8px; border-bottom: 1px solid var(--border); }
.pop-date { font-weight: 650; font-size: 13.5px; }
.pop-sum { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.pop-list { list-style: none; margin: 6px 0 0; padding: 0; }
.pop-item {
  display: grid; grid-template-columns: 40px 8px minmax(0, 1fr) auto; align-items: start; gap: 8px;
  padding: 6px 2px; font-size: 12.5px;
}
.cal-pop.show .pop-item { animation: fade-up .35s var(--ease) both; animation-delay: calc(70ms + var(--i) * 35ms); }
/* 別の日へ切り替えたとき: 箱はそのまま、中身だけ素早く入れ替える (待ち時間なし) */
.cal-pop.show.swapping .pop-item { animation: pop-swap .2s var(--ease) both; animation-delay: calc(var(--i) * 12ms); }
.cal-pop.show.swapping .pop-head { animation: pop-swap .2s var(--ease) both; }
@keyframes pop-swap { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.pop-time { font-family: var(--mono); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.35; }
.pop-time small { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.pop-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); }
.pop-item.is-done .pop-dot { background: var(--success); border-color: var(--success); }
.pop-body { display: flex; flex-direction: column; min-width: 0; }
.pop-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item.is-done .pop-title { color: var(--text-3); text-decoration: line-through; }
.pop-detail { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-dur { font-size: 11px; color: var(--text-2); padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft); white-space: nowrap; }
.pop-more { padding: 2px 2px 0 50px; font-size: 11.5px; color: var(--text-3); }
.pop-foot { margin-top: 6px; padding: 8px 2px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); text-align: right; }

/* ------------------------------------------------------------------- day */
.day-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.day-title-wrap { display: flex; align-items: center; gap: 12px; }
.day-title-wrap > div { animation: fade-up .4s var(--ease) both; }
.day-year { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.day-nav { display: flex; align-items: center; gap: 4px; }
.today-badge {
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--accent); color: var(--accent-fg); align-self: flex-end; margin-bottom: 6px;
  animation: pop .5s var(--spring) .15s both;
}

:root { --side-w: clamp(320px, 27vw, 420px); }
.day-layout { display: block; }
/* 右の壁に密着したサイドバー: ヘッダーの下から画面の下まで、左側だけ罫線 (左の日付リストと対) */
.side {
  position: fixed; z-index: 20; right: 0; top: 52px; bottom: 0; width: var(--side-w);
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--border); background: var(--bg-soft);
  animation: side-in .5s cubic-bezier(.16, 1, .3, 1) both;
  transition: transform .45s cubic-bezier(.16, 1, .3, 1), visibility 0s;
}
@keyframes side-in { from { transform: translateX(100%); } to { transform: none; } }
.side.is-closed { transform: translateX(100%); visibility: hidden; animation: none; transition: transform .3s var(--ease), visibility 0s .3s; }
.app-main.wide { padding-right: calc(var(--side-w) + 28px); transition: padding .3s var(--ease); }
html.side-off .app-main.wide { padding-right: 68px; }
.app-main.pad-instant { transition: none !important; }
.side-top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  height: 44px; flex: none; padding: 0 6px 0 18px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.side-top-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.side-close { width: 28px; height: 28px; }
.side-close .i { width: 16px; height: 16px; }
.side-open {
  position: fixed; z-index: 20; right: 0; top: 68px;
  display: grid; place-items: center; width: 34px; height: 40px; padding: 0;
  border: 1px solid var(--border-strong); border-right: 0; border-radius: 10px 0 0 10px;
  background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-sm); cursor: pointer;
  animation: side-tab-in .35s var(--ease) both;
  transition: background-color .15s, color .15s, transform .25s var(--spring);
}
@keyframes side-tab-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.side-open:hover { background: var(--bg-hover); color: var(--text); }
.side-open:active { transform: scale(.92); }
.side-open .i { width: 18px; height: 18px; }
/* 段: 罫線で区切るだけ (カードにしない)。見出しを押すと折りたたむ */
.side-sec { padding: 12px 18px 16px; border-bottom: 1px solid var(--border); animation: fade-up .45s var(--ease) both; }
.side-sec:nth-of-type(2) { animation-delay: .04s; }
.side-sec:last-child { border-bottom: 0; }
.side-fold {
  display: inline-flex; align-items: center; gap: 5px; margin-left: -4px; padding: 3px 6px 3px 4px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3); font: inherit; cursor: pointer; transition: background-color .15s, color .15s;
}
.side-fold:hover { background: var(--bg-hover); color: var(--text-2); }
.side-fold .chev { width: 13px; height: 13px; stroke-width: 2.4; transition: transform .3s var(--spring); }
.side-sec.is-folded .side-fold .chev { transform: rotate(-90deg); }
.side-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .32s var(--ease), opacity .25s var(--ease); }
.side-inner { min-height: 0; overflow: hidden; padding: 2px; margin: -2px; } /* フォーカス枠が切れない程度の余白 */
.side-sec.is-folded .side-body { grid-template-rows: 0fr; opacity: 0; }
.side-sec.is-folded { padding-bottom: 12px; }
.side-sec.is-folded .side-head { margin-bottom: 0; }
.side-head { transition: margin-bottom .3s var(--ease); }
.memo-status { margin-left: auto; font-size: 11.5px; color: var(--text-3); animation: fade-up .25s var(--ease); }
.memo-status[data-kind="failed"] { color: var(--danger); }
.memo-hint { display: block; margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: var(--text-3); }
.side .timer-card { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 12px 18px 18px; }
.side .timer-card[data-status="running"] { box-shadow: none; }
.schedule .summary-card { margin-top: 22px; }

/* 右側の 3 段: タスク情報 / メモ / タイマー */
.side-card {
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm); animation: fade-up .45s var(--ease) both;
}
.task-memo { animation-delay: .05s; }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 26px; }
.side-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.side-proj { min-width: 0; }
.side-edit { margin-left: auto; width: 28px; height: 28px; }
.side-edit .i { width: 15px; height: 15px; }
.task-info .timer-info { min-height: 0; }
.task-info .timer-title { margin-top: 0; font-size: 18px; }
.task-info.is-idle .timer-title { color: var(--text-2); font-weight: 500; font-size: 15px; }
.task-info .timer-sub { margin-top: 3px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.task-info.is-idle .timer-sub { font-family: var(--font); }
.memo-body { max-height: 300px; overflow-y: auto; }
.memo-body.swap { animation: swap-in .4s var(--ease) both; }
.memo-text { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.memo-empty { margin: 0; font-size: 12.5px; color: var(--text-3); }
.memo-atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.memo-text + .memo-atts { margin-top: 12px; }
.memo-atts:first-child { margin-top: 0; }
.memo-atts.is-one { grid-template-columns: 1fr; }
.memo-atts.is-one .memo-att { height: auto; max-height: 240px; aspect-ratio: auto; }
.memo-atts.is-one .memo-att img { max-height: 228px; }
/* 画像は枠の中に収め、切り抜かずに全体を見せる */
.memo-att {
  display: grid; place-items: center; height: 110px; padding: 4px; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft);
  transition: border-color .15s, transform .2s var(--spring);
}
.memo-att:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.memo-att img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.timer-head { margin-bottom: 0; }

/* ---------------------------------------------- メモ (文章と画像を交互に) */
.memo-editor {
  position: relative; display: flex; flex-direction: column; min-height: 92px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: text;
  transition: border-color .15s, box-shadow .2s, background-color .2s;
}
.memo-editor:focus-within, .memo-editor.is-drop, #taskModal .modal-panel.dragging .memo-editor {
  border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft);
}
.memo-editor.is-drop { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.memo-editor.swap { animation: swap-in .4s var(--ease) both; }
/* 編集画面の入力欄の見た目 (.field textarea など) に負けないよう、強めのセレクターで */
.memo-editor textarea.me-text, .field .memo-editor textarea.me-text {
  display: block; width: 100%; height: auto; min-height: 1.7em; margin: 0; padding: 0; border: 0; border-radius: 0; outline: none;
  resize: none; overflow: hidden; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.7; box-shadow: none;
}
.memo-editor textarea.me-text:focus { border: 0; box-shadow: none; background: transparent; }
/* 対応ブラウザでは高さを CSS だけで中身に合わせる (JS で測り直すより軽い) */
@supports (field-sizing: content) { .memo-editor textarea.me-text { field-sizing: content; } }
.memo-editor textarea.me-text::placeholder { color: var(--text-3); }
.memo-editor textarea.me-text.is-gap:not(:focus) { height: 8px !important; min-height: 0; }
.memo-editor.is-moving .me-text, .memo-editor.is-resizing .me-text { pointer-events: none; }
.memo-editor.is-moving, .memo-editor.is-moving * { cursor: grabbing !important; }
.memo-editor.is-resizing, .memo-editor.is-resizing * { cursor: ew-resize !important; user-select: none; }
.me-img {
  position: relative; width: fit-content; max-width: 100%; margin: 6px 0; border-radius: 8px;
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  animation: me-in .35s var(--spring) both; transition: box-shadow .15s, opacity .2s;
}
@keyframes me-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.me-img img { display: block; max-width: 100%; height: auto; border-radius: 8px; pointer-events: none; }
.me-img[style] img { width: 100%; }
.me-img:hover { box-shadow: 0 0 0 1px var(--border-strong); }
.me-img.is-picked { box-shadow: 0 0 0 2px var(--accent-line); }
.me-img.is-moving { position: relative; z-index: 3; opacity: .9; box-shadow: var(--shadow-lg); transition: none; animation: none; }
.me-img.me-drop { animation: pop .4s var(--spring); }
.me-img.is-uploading img { filter: grayscale(.4) blur(1px); opacity: .55; }
.me-img .att-spin { position: absolute; top: 50%; left: 50%; margin: -9px 0 0 -9px; }
.me-x {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(15, 15, 15, .62); color: #fff; cursor: pointer;
  opacity: 0; transition: opacity .15s, transform .2s var(--spring);
}
.me-x .i { width: 12px; height: 12px; stroke-width: 2.5; }
.me-img:hover .me-x, .me-x:focus-visible { opacity: 1; }
.me-x:active { transform: scale(.85); }
/* 右端の取っ手: ここをドラッグで大きさを変更 (縦横比はそのまま) */
.me-resize { position: absolute; top: 0; right: -6px; bottom: 0; width: 12px; display: flex; align-items: center; justify-content: center; cursor: ew-resize; }
.me-resize::after {
  content: ""; width: 4px; height: 38px; max-height: 70%; border-radius: 4px; background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface); opacity: 0; transform: scaleY(.6); transition: opacity .15s, transform .2s var(--spring);
}
.me-img:hover .me-resize::after, .me-img.is-resizing .me-resize::after { opacity: 1; transform: none; }
@media (hover: none) { .me-x, .me-resize::after { opacity: 1; } }
/* 画像を置く位置の印 */
.me-ind {
  position: absolute; left: 8px; right: 8px; top: 0; height: 2px; border-radius: 2px; background: var(--accent);
  opacity: 0; pointer-events: none; transition: transform .1s var(--ease), opacity .12s;
}
.me-ind.show { opacity: 1; }
.me-ind::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
#taskModal .memo-editor { min-height: 120px; }
.timer-head .status-chip { margin-left: auto; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item {
  display: grid; grid-template-columns: 56px 22px minmax(0, 1fr); column-gap: 10px;
  animation: tl-in .5s var(--ease) both; animation-delay: calc(min(var(--i), 14) * 55ms);
  /* 画面の外のタスクはレイアウト・描画を飛ばす (タスクが多い日でも開くのが速い)。
     影やホバーの浮きが切れないよう、はみ出しを描く範囲を広げておく */
  content-visibility: auto; contain-intrinsic-size: auto 96px; overflow-clip-margin: 28px;
}
.timeline.no-anim .tl-item { animation: none; }
.tl-time { padding-top: 13px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tl-start { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.tl-end { display: block; font-size: 11px; color: var(--text-3); }
.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.tl-item:first-child .tl-rail::before { top: 20px; }
.tl-item:last-child .tl-rail::before { bottom: auto; height: 20px; }
.tl-item:only-child .tl-rail::before { display: none; }
.tl-dot {
  position: relative; z-index: 1; margin-top: 15px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-strong);
  transition: background-color .3s, border-color .3s, box-shadow .3s, transform .4s var(--spring);
}
.tl-item.is-selected .tl-dot { background: var(--accent-line); border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); transform: scale(1.15); }
.tl-item.is-running .tl-dot::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  background: color-mix(in srgb, var(--accent-line) 35%, transparent);
  animation: ripple-dot 1.8s ease-out infinite; will-change: transform, opacity;
}
.tl-item.is-done .tl-dot { background: var(--success); border-color: var(--success); }

.tl-card {
  position: relative; margin-bottom: 10px; padding: 12px 14px;
  user-select: none; -webkit-user-select: none; /* ダブルクリックで文字が選択されないように */
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; outline: none;
  transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease), background-color .2s;
}
.tl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tl-card:active { transform: scale(.99); }
.tl-card:focus-visible { box-shadow: 0 0 0 2px var(--accent-line); }
.tl-item.is-selected .tl-card { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-md); }
.tl-item.is-done .tl-card { background: var(--surface-2); }
.tl-item.is-done .tl-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.tl-top { display: flex; align-items: center; gap: 8px; }
.tl-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-detail {
  margin: 4px 0 0; color: var(--text-2); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line;
}
.tl-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); white-space: nowrap;
}
.badge .i { width: 12px; height: 12px; }
.badge-done { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }
.badge-live { color: var(--text); border-color: var(--accent-line); }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-3); text-align: center; animation: fade-up .5s var(--ease) both;
}
.empty > .i { width: 32px; height: 32px; stroke-width: 1.5; animation: float 3s ease-in-out infinite; }
.empty p { margin: 0; }

/* side / timer */
/* (サイドバーは上の .side を参照) */
.timer-card, .summary-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.timer-card { padding: 16px 18px 14px; animation: fade-up .5s var(--ease) .1s both; transition: box-shadow .4s var(--ease), border-color .4s; }
.timer-card[data-status="running"] { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.timer-info { min-height: 84px; }
.timer-info.swap { animation: swap-in .45s var(--ease) both; }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft);
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); transition: background-color .3s; }
.timer-card[data-status="ready"] .status-dot { background: var(--text); }
/* 作業中 (Focusing) と一時停止中 (Paused) は点を出さない */
.timer-card[data-status="running"] .status-dot,
.timer-card[data-status="paused"] .status-dot { display: none; }
.timer-title { margin-top: 10px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; line-height: 1.35; overflow-wrap: anywhere; }
.timer-card[data-status="idle"] .timer-title { color: var(--text-2); font-weight: 500; }
.timer-sub { margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

/* 円の幅は常に 210px (サイドバーもスマホも十分広い) なので、文字の大きさは固定値。
   コンテナクエリにすると、スタイルを決めるたびにレイアウトも必要になって重くなる */
.ring-wrap { position: relative; width: min(210px, 100%); aspect-ratio: 1; margin: 10px auto 12px; }
.ring-wrap::after {
  content: ""; position: absolute; inset: 4%; border-radius: 50%;
  border: 1px solid var(--accent-line); opacity: 0; pointer-events: none;
}
.timer-card[data-status="running"] .ring-wrap::after { animation: ring-ripple 2.6s ease-out infinite; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: var(--ring-track); stroke-width: 8; }
.ring-progress {
  fill: none; stroke: var(--accent-line); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 628.32; stroke-dashoffset: 628.32;
  transition: stroke-dashoffset .3s linear, opacity .4s, stroke .4s;
}
.ring-knob {
  transform-box: view-box; transform-origin: center;
  transition: transform .3s linear, opacity .3s;
}
.ring-knob circle { fill: var(--surface); stroke: var(--accent-line); stroke-width: 3; transition: stroke .4s; }
.timer-card.is-setting .ring-progress { transition: stroke-dashoffset 1.1s var(--ease-in-out); }
.timer-card.is-setting .ring-knob { transition: transform 1.1s var(--ease-in-out), opacity .3s; }
.timer-card[data-status="idle"] .ring-knob,
.timer-card[data-status="idle"] .ring-progress { opacity: 0; } /* round cap の点が残らないように */
.timer-card[data-status="paused"] .ring-progress { opacity: .35; }
.timer-card[data-status="finished"] .ring-progress { stroke: var(--success); }

.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.timer-time {
  font-family: var(--mono); font-size: 48px; font-weight: 600; letter-spacing: -.01em; line-height: 1;
  font-variant-numeric: tabular-nums; transition: color .3s, transform .4s var(--spring);
}
.timer-time.is-long { font-size: 38px; }
.timer-card[data-status="idle"] .timer-time { color: var(--text-3); }
.timer-card[data-status="paused"] .timer-time { animation: blink 1.4s ease-in-out infinite; }
.timer-card.tick-pop .timer-time { animation: nudge .5s var(--spring); }
.timer-meta { margin-top: 8px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.timer-controls { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 40px; }
.timer-controls .ctl:not([hidden]) { animation: ctl-in .35s var(--spring) both; }
.timer-controls .ctl:nth-child(n+2):not([hidden]) { animation-delay: .04s; }
.ctl-cancel { color: var(--text-2); }

.timer-foot {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
}
.timer-foot > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timer-foot .k { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-foot .v { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.summary-card { padding: 16px 18px; animation: fade-up .5s var(--ease) .16s both; }
.summary-card .section-label { margin-bottom: 10px; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary-stats > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-soft); }
.summary-stats .v { font-size: 18px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary-stats .k { font-size: 11.5px; color: var(--text-3); }
.record-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.record-list:empty { display: none; }
.record {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; outline: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  animation: fade-right .4s var(--ease) both; animation-delay: calc(var(--i) * 40ms);
  transition: background-color .15s, transform .25s var(--ease);
}
.record-list.no-anim .record { animation: none; }
.record { flex: none; } /* 一覧の高さ制限で行が縮んで時刻が切れないように */
.record:hover { background: var(--bg-hover); }
.record:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-line); }
.record:active { transform: scale(.985); }
.record > :not(.record-hold) { position: relative; } /* 長押しバーより前面 */
.record-check { display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--success); color: #fff; }
.record-check .i { width: 11px; height: 11px; stroke-width: 3; }
.record-body { display: flex; flex-direction: column; min-width: 0; }
.record-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-time { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.record-note, .tl-note {
  display: flex; align-items: flex-start; gap: 5px; margin-top: 4px;
  font-size: 12px; color: var(--text-2); line-height: 1.5;
}
.record-note .i, .tl-note .i { width: 12px; height: 12px; margin-top: 3px; flex: none; color: var(--text-3); }
.record-note span, .tl-note span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-line; overflow-wrap: anywhere;
}
.record-dur { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); margin-top: 1px; }

/* 長押しで削除: 押している間バーが伸びる */
.record-hold {
  position: absolute; inset: 0; pointer-events: none;
  background: var(--danger-soft); border-left: 2px solid var(--danger);
  transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform .25s var(--ease), opacity .25s;
}
.record.holding { transform: scale(.985); }
.record.holding .record-hold { transform: scaleX(1); opacity: 1; transition: transform .65s linear, opacity .1s; }
.record.holding .record-check { animation: shake .4s var(--ease) .45s; }
.record.removing { animation: record-out .34s var(--ease) forwards; pointer-events: none; }

/* タイムライン上の完了メモ (クリックで詳細) */
.tl-note {
  margin-top: 8px; padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px solid var(--border);
  transition: border-color .15s, background-color .15s;
}
.tl-note:hover { border-color: var(--border-strong); background: var(--bg-hover); }

/* ----------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 11vh 16px 16px; overflow-y: auto;
}
.modal-backdrop {
  position: fixed; inset: 0; background: var(--scrim);
  opacity: 0; /* 全画面のぼかし (backdrop-filter) は下で何か動くたびに再計算されて重いので使わない */
  transition: opacity .25s var(--ease);
}
.modal-panel {
  position: relative; width: min(540px, 100%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(18px) scale(.96);
  transition: opacity .2s var(--ease), transform .25s var(--ease);
}
/* 閉じるアニメーション中 (フェードアウト中) のモーダル・完了カードはクリックを奪わない */
.modal:not(.open), .finish:not(.open) { pointer-events: none; }
.modal.open .modal-backdrop { opacity: 1; }
.modal.open .modal-panel { opacity: 1; transform: none; transition: opacity .25s var(--ease), transform .45s var(--spring); }
.modal-panel.shake { animation: shake .4s var(--ease); }
.modal-sm { width: min(460px, 100%); }
.modal-xs { width: min(380px, 100%); margin-top: 8vh; }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 20px; }
.modal-head h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 12px 20px 20px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.spacer { flex: 1; }

/* modal 内要素のスタッガー表示 */
.modal.open .modal-body > * { animation: fade-up .45s var(--ease) both; }
.modal.open .modal-body > *:nth-child(2) { animation-delay: .04s; }
.modal.open .modal-body > *:nth-child(3) { animation-delay: .08s; }
.modal.open .modal-body > *:nth-child(4) { animation-delay: .12s; }
.modal.open .modal-body > *:nth-child(5) { animation-delay: .16s; }

.title-input {
  width: 100%; padding: 4px 0; border: 0; outline: none; background: transparent;
  color: var(--text); font: inherit; font-size: 24px; font-weight: 700; letter-spacing: -.02em;
}
.title-input::placeholder { color: var(--text-3); opacity: .7; }
.title-input.invalid::placeholder { color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 12px; color: var(--text-3); min-height: 18px; transition: color .2s; }
.field input, .field textarea, .num-input input {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px;
  outline: none; transition: border-color .15s, box-shadow .2s var(--ease);
}
.field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .num-input input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.duration-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-group { position: relative; display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); }
.chip-btn {
  position: relative; height: 28px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: background-color .2s, color .2s, transform .25s var(--spring), box-shadow .2s;
}
.chip-btn:hover { color: var(--text); background: var(--bg-hover); }
.chip-btn:active { transform: scale(.92); }
.chip-btn.active { background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-sm); }
.num-input { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.num-input input { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }

/* settings */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; }
.setting-name { font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-3); }
.segmented {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); flex: none;
}
.segmented button {
  position: relative; z-index: 1; height: 28px; padding: 0 12px; border: 0; background: transparent;
  color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: color .25s;
}
.segmented button.active { color: var(--text); }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.segmented.two .seg-indicator { width: calc((100% - 6px) / 2); }
.segmented button[lang="ja"] { font-family: var(--font); }
/* 言語切替時: 差し替わった文字をふわっと出す */
.lang-swap { animation: lang-swap .35s var(--ease); }
@keyframes lang-swap { from { opacity: .35; } to { opacity: 1; } }
.seg-indicator {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  border-radius: 6px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  transform: translateX(calc(var(--idx, 0) * 100%)); transition: transform .45s var(--spring);
}
.switch {
  position: relative; width: 40px; height: 24px; flex: none; padding: 0;
  border: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer;
  transition: background-color .25s var(--ease);
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .4s var(--spring);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(16px); background: var(--accent-fg); }
.shortcuts {
  display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
kbd {
  display: inline-block; min-width: 20px; margin-right: 3px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--bg-soft); font-family: var(--mono); font-size: 11px; color: var(--text-2); text-align: center;
}

.confirm-title { margin: 6px 0 0; font-size: 16px; font-weight: 650; }
.confirm-msg { margin: 0; color: var(--text-2); white-space: pre-line; }

/* ------------------------------------------------------------ finish card */
.finish { position: fixed; inset: 0; z-index: 60; }
.finish-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .35s var(--ease); }
.finish-card {
  position: absolute; top: 12px; right: 12px; bottom: 12px;
  display: flex; flex-direction: column; gap: 16px;
  width: min(410px, calc(100vw - 24px)); padding: 28px 24px 22px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 32px));
  transition: transform .35s var(--ease);
}
.finish.open .finish-scrim { opacity: 1; }
.finish.open .finish-card { transform: none; transition: transform .7s var(--spring); }
.finish.open .finish-card > * { animation: fade-up .5s var(--ease) both; animation-delay: calc(.18s + var(--d, 0) * 55ms); }

.fc-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.finish.open .finish-card > .fc-close { animation: fade-up .4s var(--ease) .25s both; }
.fc-note-state { margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--text-3); transition: color .2s; }
.fc-note-state.dirty { color: var(--text); animation: fade-right .3s var(--ease); }
/* 閲覧モード (記録をクリックして開いたとき) は見出しを控えめな色に */
.finish[data-mode="view"] .fc-eyebrow { color: var(--text-3); }
.fc-check svg { width: 56px; height: 56px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fc-check circle { stroke: var(--success); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; }
.fc-check path { stroke: var(--success); stroke-width: 3.5; stroke-dasharray: 34; stroke-dashoffset: 34; }
.finish.open .fc-check circle { animation: draw .7s var(--ease) .3s forwards; }
.finish.open .fc-check path { animation: draw .45s var(--ease) .85s forwards; }
.finish.open .fc-check svg { animation: pop .6s var(--spring) .85s; }

.fc-eyebrow { font-size: 12px; font-weight: 600; color: var(--success); letter-spacing: .04em; margin-bottom: -10px; }
.fc-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; overflow-wrap: anywhere; }
.fc-detail { margin: -8px 0 0; color: var(--text-2); font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; }
.fc-detail:empty { display: none; }

.fc-progress-bar { height: 6px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.fc-progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent-line); transition: width 1.1s var(--ease-in-out) .45s; }
.fc-progress-label { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.fc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.fc-stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.fc-stat-main { grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.fc-stat dt { font-size: 11.5px; color: var(--text-3); }
.fc-stat-main dt { color: inherit; opacity: .65; }
.fc-stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fc-stat-main dd { font-size: 30px; }

.fc-span { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); font-family: var(--mono); }
.fc-span .i { color: var(--text-3); }
.finish-card .btn-block { margin-top: auto; flex: none; }

/* ------------------------------------------------------------------ toast */
/* ------------------------------------------- 進行中のタスクの共有 (誰が作業中か・参加者・こなした人) */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { width: 20px; height: 20px; font-size: 10px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.avatar-stack .avatar.more { background: var(--bg-soft); color: var(--text-2); }
.tl-live {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); font-size: 12px; color: var(--text-2);
}
.tl-live.is-paused { background: var(--bg-soft); }
.tl-live-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--success); animation: pulse-dot 1.6s ease-in-out infinite; }
.tl-live.is-paused .tl-live-dot { background: var(--text-3); animation: none; }
.tl-live-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-live-who b { color: var(--text); font-weight: 600; }
.tl-live-time { margin-left: auto; flex: none; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.tl-live-bar { height: 3px; margin-top: 6px; border-radius: 3px; background: var(--ring-track); overflow: hidden; }
.tl-live-bar span { display: block; height: 100%; background: var(--accent-line); border-radius: 3px; transition: width .8s linear; }
.tl-live.is-paused + .tl-live-bar span { background: var(--text-3); }
.done-by { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-3); min-width: 0; }
.done-by .done-names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-card .done-by { margin-top: 8px; }
.timer-people {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-soft); font-size: 12px; color: var(--text-2); min-width: 0;
}
.timer-people .tp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-people b { color: var(--text); font-weight: 600; }
.timer-card[data-role="viewer"] .ring-progress, .timer-card[data-role="member"] .ring-progress { stroke: color-mix(in srgb, var(--accent-line) 70%, var(--text-3)); }

/* ------------------------------------------- タイマーのオーバーレイ (右下) */
.timer-dock {
  position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 45;
  width: 300px; height: 0; pointer-events: none; /* 中身 (窓 / 丸) だけがクリックを受ける */
}
.td-panel, .td-bubble { position: absolute; right: 0; bottom: 0; pointer-events: auto; }
.td-panel {
  width: 100%; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-lg); transform-origin: 100% 100%;
  transition: opacity .22s var(--ease), transform .32s var(--spring), visibility 0s;
}
.td-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px -6px 2px 0; }
.td-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.td-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse-dot 1.6s ease-in-out infinite; }
.timer-dock[data-status="paused"] .td-dot { background: var(--text-3); animation: none; }
.td-min { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .15s; }
.td-min:hover { background: var(--bg-hover); color: var(--text); }
.td-min .i { width: 16px; height: 16px; stroke-width: 2.4; }
.td-title {
  display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.td-title:hover { color: var(--accent-line); text-decoration: underline; text-underline-offset: 3px; }
.td-time { margin-top: 4px; font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.timer-dock[data-status="paused"] .td-time { animation: blink 1.4s ease-in-out infinite; }
.td-ends { margin-top: 2px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.td-bar { height: 4px; margin: 10px 0 12px; border-radius: 4px; background: var(--ring-track); overflow: hidden; }
.td-bar span { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--accent-line); transition: width .6s linear; }
.timer-dock[data-status="paused"] .td-bar span { background: var(--text-3); }
.td-ctl { display: flex; flex-wrap: wrap; gap: 6px; }
.td-ctl .btn { flex: 1 1 auto; justify-content: center; }
.td-ctl .td-cancel { flex: 0 1 auto; }
.td-ctl .btn .i { width: 14px; height: 14px; }
/* 最小化した丸い時計: 周りの輪が進み具合 */
.td-bubble {
  display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--accent-line); box-shadow: var(--shadow-lg); cursor: pointer;
  transition: opacity .2s var(--ease), transform .35s var(--spring), visibility 0s;
}
.td-bubble:hover { transform: scale(1.06); }
.td-bubble:active { transform: scale(.94); }
.td-bubble > .i { width: 22px; height: 22px; }
.td-ring { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); transform: rotate(-90deg); pointer-events: none; }
.td-ring circle { fill: none; stroke-width: 3; }
.td-ring-track { stroke: var(--ring-track); }
.td-ring-bar { stroke: var(--accent-line); stroke-linecap: round; stroke-dasharray: 144.51; stroke-dashoffset: 144.51; transition: stroke-dashoffset .6s linear; }
.timer-dock[data-status="paused"] .td-bubble { color: var(--text-3); }
.timer-dock[data-status="paused"] .td-ring-bar { stroke: var(--text-3); }
/* 表示 / 最小化の切り替え (どちらも右下を起点に縮む・広がる) */
.timer-dock:not(.show) .td-panel, .timer-dock.is-min .td-panel {
  opacity: 0; transform: scale(.25); visibility: hidden; pointer-events: none;
  transition: opacity .18s var(--ease), transform .25s var(--ease), visibility 0s .25s;
}
.timer-dock:not(.show) .td-bubble, .timer-dock:not(.is-min) .td-bubble {
  opacity: 0; transform: scale(.4); visibility: hidden; pointer-events: none;
  transition: opacity .15s var(--ease), transform .2s var(--ease), visibility 0s .2s;
}
@media (max-width: 640px) {
  .timer-dock { right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); width: min(300px, calc(100vw - 24px)); }
}
.toasts {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 9px; background: var(--ink); color: var(--ink-fg);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in .45s var(--spring) both;
}
/* 長いタスク名 (空白なし) でも画面からはみ出さない: 幅は画面まで、文は折り返し、3 行で省略 */
.toasts { width: max-content; max-width: calc(100vw - 32px); }
.toast { max-width: min(560px, 100%); }
.toast > span { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.toast > .i, .toast > svg { flex: none; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { animation: toast-out .25s var(--ease) forwards; }

/* ------------------------------------------------------------- keyframes */
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-right { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes cell-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slide-from-right { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slide-from-left { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes tl-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
/* ぼかし (filter: blur) は画像入りの広い範囲だと毎フレーム GPU で重いので、透明度と位置だけで切り替える */
@keyframes swap-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* to に opacity を書かない → disabled ボタンの opacity を上書きしない */
@keyframes ctl-in { from { opacity: 0; transform: translateY(6px) scale(.92); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes nudge { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes pill-in { from { opacity: 0; transform: translateY(-10px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.65); opacity: .55; } }
@keyframes ripple-dot { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.8); opacity: 0; } }
@keyframes ring-ripple { 0% { transform: scale(.94); opacity: .28; } 100% { transform: scale(1.12); opacity: 0; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes record-out {
  0%   { opacity: 1; transform: none; max-height: 120px; }
  60%  { opacity: 0; transform: translateX(24px); max-height: 120px; padding-top: 8px; padding-bottom: 8px; }
  100% { opacity: 0; transform: translateX(24px); max-height: 0; padding-top: 0; padding-bottom: 0; }
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .day-layout { display: flex; flex-direction: column; gap: 20px; }
  .side, .side.is-closed {
    position: static; order: -1; width: auto; overflow: visible; transform: none; visibility: visible;
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); animation: fade-up .45s var(--ease) both;
  }
  .side-top, .side-open { display: none !important; }
  .app-main.wide, html.side-off .app-main.wide { padding-right: 28px; }
}
@media (max-width: 640px) {
  .app-header { padding: 0 12px; }
  .brand-name, .btn-label, .crumb-sep, .crumbs, .run-title { display: none; }
  .app-main { padding: 18px 12px 48px; }
  .page-title { font-size: 22px; }
  .cal-grid { grid-auto-rows: minmax(68px, auto); }
  .cal-weekdays span { padding: 6px 4px; text-align: center; }
  .cal-cell { padding: 4px 3px; }
  .cal-cell-head { justify-content: center; }
  .cal-add { display: none; }
  .chip { padding: 0; height: 5px; border: 0; background: var(--text-2); border-radius: 3px; }
  .chip > *, .chip.is-done::before { display: none; }
  .chip.is-done { background: var(--success); }
  .chip-more { text-align: center; padding: 0; }
  .field-row { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 44px 18px minmax(0, 1fr); column-gap: 6px; }
    .setting { flex-direction: column; align-items: flex-start; }
}

/* ------------------------------------------------------- phone polish */
/* タッチ端末では Ctrl+V / ドラッグの案内は出さない */
@media (hover: none) and (pointer: coarse) { .memo-hint { display: none !important; } }
@media (max-width: 960px) {
  /* タスク未選択のときはスケジュールを先に (選ぶとタスク情報とタイマーが上に) */
  .side:not(.has-task) { order: 1; }
}
@media (max-width: 640px) {
  /* © は固定せず、ページの最後に置く (内容に重ならないように) */
  .app-footer, html.in-day .app-footer, html.in-day.side-off .app-footer {
    position: static; right: auto; bottom: auto; padding: 4px 16px 14px; text-align: right;
  }
  .app-main { padding-bottom: 20px; }
  /* メンバー: 名前を 1 行目、役割と操作を 2 行目に */
  .ps-member { flex-wrap: wrap; row-gap: 6px; }
  .ps-member .ps-who { flex: 1 1 calc(100% - 42px); }
  .ps-member .ps-who + * { margin-left: 42px; }
  .ps-member .ps-who + * + .btn { margin-left: auto; }
  /* 管理者: ユーザーの追加は 1 列、一覧は 2 行に */
  .ad-form { grid-template-columns: 1fr; }
  .ad-mail-note { margin-top: 14px; }
  .ad-user-row { flex-wrap: wrap; row-gap: 6px; }
  .ad-user .ad-who { flex: 1 1 calc(100% - 46px); }
  .ad-user .ad-meta { display: flex; flex: 1; margin-left: 46px; align-items: flex-start; }
  .ad-del-spacer { display: none; }
  .ad-edit { padding: 2px 10px 14px; }
  .ad-edit .field:nth-child(3) { grid-column: auto; }
  .ad-form-foot { flex-wrap: wrap; }
}

/* -------------------------------------------- 日付のバッジ: 昨日 / 明日 は控えめに */
.today-badge.is-near { background: var(--accent-soft); color: var(--accent-line); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-line) 25%, transparent); }

/* ------------------------------------- ホームの表示: 日数 (Day 1, Day 2 …) */
#calendarView.is-days > .cal-toolbar, #calendarView.is-days > .cal { display: none; }

/* ============================================================ ホーム (ウィジェット) */
.home-bar { position: relative; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: 32px; margin: -6px 0 12px; } /* 追加メニューをウィジェットより前に */
.home-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; animation: fade-up .3s var(--ease) both; }
.home-hint { font-size: 12px; color: var(--text-3); }
.home-edit { color: var(--text-2); }
.home-add-wrap { position: relative; }
.wg-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 46; width: 300px; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
  animation: fade-up .2s var(--ease) both;
}
.wg-menu-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; column-gap: 10px; width: 100%;
  padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.wg-menu-item:hover:not(:disabled), .wg-menu-item:focus-visible { background: var(--bg-hover); }
.wg-menu-item:disabled { opacity: .45; cursor: not-allowed; }
.wg-menu-item .wmi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-line); }
.wg-menu-item .wmi-icon .i { width: 16px; height: 16px; }
.wg-menu-item b { display: block; font-size: 13px; font-weight: 600; }
.wg-menu-item small { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }

/* z-index: 0 = 重ね順をボードの中に閉じる (自由配置で手前にしたものが、上の追加メニューより前に出ないように) */
.home-board { position: relative; z-index: 0; min-height: 120px; }
.wg { position: absolute; left: 0; top: 0; min-width: 0; }
/* 動きは編集中だけ (並び直すときの移動)。大きさはアニメーションしない (中身のレイアウトが毎フレーム走る) */
.home-board.is-editing:not(.is-free) .wg { transition: transform .28s var(--ease); }
/* 登場アニメーションは追加したものだけ、中身に (.wg の transform は位置なので上書きしない) */
.wg.is-new > .wg-body { animation: fade-up .35s var(--ease) both; }
/* 中身の変化をウィジェットの中に閉じる (ほかのウィジェット・ページ全体を測り直さない) */
.wg:not(.wg-calendar) > .wg-body { contain: strict; }
.wg-body {
  position: relative; height: 100%; overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.wg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 6px; flex: none; }
.wg-title { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.wg-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; }
.wg-empty { margin: auto; padding: 12px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* 編集中: つかむ面・大きさを変える端・設定 / 削除 */
.wg-edit { display: none; }
.home-board.is-editing .wg-edit { display: block; position: absolute; inset: 0; z-index: 3; border-radius: var(--radius-lg); cursor: grab; touch-action: none; }
.home-board.is-editing .wg-body { pointer-events: none; user-select: none; }
.home-board.is-editing .wg-edit::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1.5px dashed color-mix(in srgb, var(--accent-line) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 3%, transparent); transition: background-color .15s, border-color .15s;
}
.home-board.is-editing .wg:hover .wg-edit::before, .home-board.is-editing .wg.is-sel .wg-edit::before { border-style: solid; border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.wg.is-dragging { transition: none !important; z-index: 900 !important; } /* つかんだものは遅れずにマウスに付いてくる (編集中の移動アニメーションより優先) */
.wg.is-dragging .wg-edit { cursor: grabbing; }
.wg.is-dragging .wg-body { box-shadow: var(--shadow-lg); }
.wg-tools { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 4px; }
.wg-btn {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-sm); cursor: pointer; transition: background-color .15s, color .15s;
}
.wg-btn:hover { background: var(--bg-hover); color: var(--text); }
.wg-btn.is-del:hover { background: var(--danger-soft); color: var(--danger); }
.wg-btn .i { width: 14px; height: 14px; }
.wg-tag {
  position: absolute; left: 10px; top: 10px; z-index: 2; padding: 2px 8px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 11px; font-weight: 600; color: var(--text-2); pointer-events: none;
}
.rh { position: absolute; z-index: 2; }
.rh-e, .rh-w { top: 14px; bottom: 14px; width: 12px; cursor: ew-resize; }
.rh-e { right: -6px; } .rh-w { left: -6px; }
.rh-n, .rh-s { left: 14px; right: 14px; height: 12px; cursor: ns-resize; }
.rh-n { top: -6px; } .rh-s { bottom: -6px; }
.rh-ne, .rh-nw, .rh-se, .rh-sw { width: 18px; height: 18px; }
.rh-ne { top: -7px; right: -7px; cursor: nesw-resize; } .rh-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.rh-nw { top: -7px; left: -7px; cursor: nwse-resize; } .rh-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
/* 端に寄せたときだけ細い線で示す */
.rh-e::after, .rh-w::after { content: ""; position: absolute; top: 50%; left: 4px; width: 4px; height: 28px; margin-top: -14px; border-radius: 4px; background: var(--accent-line); opacity: 0; transition: opacity .15s; }
.rh-n::after, .rh-s::after { content: ""; position: absolute; left: 50%; top: 4px; height: 4px; width: 28px; margin-left: -14px; border-radius: 4px; background: var(--accent-line); opacity: 0; transition: opacity .15s; }
.rh-se::after, .rh-sw::after, .rh-ne::after, .rh-nw::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent-line); opacity: 0; transition: opacity .15s; }
.wg:hover .rh::after, .wg.is-sel .rh::after, .rh:hover::after { opacity: 1; }
.wg-ghost {
  position: absolute; left: 0; top: 0; z-index: 1; border-radius: var(--radius-lg); pointer-events: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1.5px dashed var(--accent-line);
  transition: transform .15s var(--ease), width .15s var(--ease), height .15s var(--ease);
}
.home-board.is-editing.is-free { background-image: none; }
.wg-guide { position: absolute; left: 0; top: 0; z-index: 950; pointer-events: none; background: var(--accent); }
.wg-guide.v { width: 1px; height: 100%; }
.wg-guide.h { height: 1px; width: 100%; }
.home-free { display: inline-flex; align-items: center; gap: 8px; padding: 0 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; user-select: none; }
.home-free .switch { width: 34px; height: 20px; }
.home-free .switch span { width: 14px; height: 14px; }
.home-free .switch[aria-checked="true"] span { transform: translateX(14px); }
.home-board.is-editing:not(.is-free) { background-image: radial-gradient(circle, color-mix(in srgb, var(--text-3) 35%, transparent) 1px, transparent 1.2px); background-size: var(--col-w, 80px) 42px; border-radius: 10px; }

/* 狭い画面: 1 列に並べる (編集は広い画面だけ) */
.home-board.is-narrow { display: flex; flex-direction: column; gap: 12px; height: auto !important; }
.home-board.is-narrow .wg { position: static; transform: none !important; width: auto !important; }

/* カレンダー: ウィジェットの大きさいっぱいに */
.wg-calendar .wg-body { border: 0; background: transparent; box-shadow: none; overflow: visible; }
.wg-calendar .cal-toolbar { margin-bottom: 12px; flex: none; }
.wg-calendar .cal { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wg-calendar .cal-grid { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
.wg-calendar .cal-cell { min-height: 0; overflow: hidden; }
.home-board.is-narrow .wg-calendar .cal-grid { grid-auto-rows: minmax(68px, auto); }
.home-board.is-narrow .wg-calendar { height: auto !important; }

/* 今日の日付 */
.wgc-today { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 10px; text-align: center; }
.wt-wd { font-size: 13px; font-weight: 600; color: var(--text-2); }
.wt-num { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wt-month { font-size: 12.5px; color: var(--text-3); }
.wt-dayn { margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-line); font-size: 12px; font-weight: 600; }
/* 時計 */
.wgc-clock { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; }
.wc-time { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.wc-time small { font-size: .45em; color: var(--text-3); margin-left: 2px; }
.wc-date { font-size: 12.5px; color: var(--text-3); }
/* 自由ラベル */
.wgc-label { flex: 1; display: flex; flex-direction: column; justify-content: safe center; /* 入りきらないときは上から (上が切れない) */ padding: 14px 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; min-height: 0; overflow: hidden; }
.wgc-label.size-s { font-size: 13px; } .wgc-label.size-m { font-size: 17px; } .wgc-label.size-l { font-size: 24px; font-weight: 600; letter-spacing: -.01em; } .wgc-label.size-xl { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.wgc-label.align-center { text-align: center; } .wgc-label.align-right { text-align: right; }
.wgc-label.tone-muted { color: var(--text-2); } .wgc-label.tone-accent { color: var(--accent-line); }
/* タスク一覧 */
.wt-group { margin: 6px 6px 2px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.wt-item {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%;
  padding: 7px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.wt-item:hover { background: var(--bg-hover); }
.wt-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wt-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-item.is-done .wt-title { color: var(--text-3); text-decoration: line-through; }
.wt-state { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.wt-state .i { width: 14px; height: 14px; color: var(--success); }
.wt-live { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse-dot 1.6s ease-in-out infinite; }
/* メンバー */
.wm-item { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
.wm-item .avatar { width: 28px; height: 28px; font-size: 12px; flex: none; }
.wm-name { min-width: 0; flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-role { font-size: 11px; color: var(--text-3); }
.wm-work { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--success); font-weight: 600; white-space: nowrap; }
.wm-work::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse-dot 1.6s ease-in-out infinite; }
/* 画像 */
.wg-image .wg-body { background: var(--bg-soft); }
.wg-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.wg-image img.fit-contain { object-fit: contain; }
.wg-image .wg-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wg-image .wg-empty .i { width: 26px; height: 26px; }
.home-board.is-editing .wg-image.is-drop .wg-edit::before { border-style: solid; background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* 日数 */
.wgc-days { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 14px 18px; }
.wd-sub { font-size: 12.5px; color: var(--text-3); }
.wd-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wd-bar { height: 4px; margin-top: 8px; border-radius: 4px; background: var(--ring-track); overflow: hidden; }
/* 設定の画面 */
.wg-form .wf-vars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wg-form .wf-var { padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft); color: var(--text-2); font: inherit; font-size: 11.5px; cursor: pointer; }
.wg-form .wf-var:hover { background: var(--bg-hover); color: var(--text); }
.wg-form .wf-preview { padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 13px; white-space: pre-wrap; color: var(--text); }
.wg-form .wf-img { display: flex; align-items: center; gap: 10px; }
.wg-form .wf-img img { width: 72px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.wg-form select, .wg-form textarea { width: 100%; }

/* ============================================================ スクロールバー
   ページ本体: 標準のスクロールバーは消し (横幅が変わって中央がずれるため)、細いものを右端に重ねる。
   ページ内のスクロール部分 (サイドバー・ダイアログ・一覧など): 細く目立たない見た目に */
:root { --scroll-thumb: color-mix(in srgb, var(--text) 20%, transparent); --scroll-thumb-hover: color-mix(in srgb, var(--text) 36%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
.page-scroll {
  position: fixed; top: 54px; right: 0; bottom: 2px; z-index: 25; width: 12px; pointer-events: none;
  opacity: 0; transition: opacity .35s var(--ease);
}
.page-scroll.can-scroll.show, .page-scroll.can-scroll.is-drag, .page-scroll.can-scroll.near { opacity: 1; transition-duration: .12s; }
.page-scroll:not(.can-scroll) { display: none; }
.page-thumb {
  position: absolute; top: 0; right: 3px; width: 5px; border-radius: 6px; background: var(--scroll-thumb);
  pointer-events: auto; cursor: default; touch-action: none;
  transition: width .15s var(--ease), right .15s var(--ease), background-color .15s;
}
.page-scroll.near .page-thumb, .page-scroll.is-drag .page-thumb, .page-thumb:hover { width: 8px; right: 2px; background: var(--scroll-thumb-hover); }
/* 日の画面 (広い画面): 右のサイドバーは画面の右端に固定なので、その左側に出す */
@media (min-width: 961px) {
  html.in-day:not(.side-off) .page-scroll { right: var(--side-w); }
}

/* ============================================ カレンダーを小さく置いたとき (data-size: s / xs) */
/* 日付の行: 「+」は幅を取らない重ね表示に。開始ラベルは数字のすぐ右、入らなければ省略 */
.cal-cell-head { position: relative; justify-content: flex-start; gap: 4px; min-width: 0; }
.cal-add { position: absolute; top: 0; right: 0; background: var(--surface); }
.cal-start { flex: 0 1 auto; overflow: hidden; margin-right: 0; }
.cal-start-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-start .i, .cal-start .proj-icon { flex: none; }
.cal-chips { min-height: 0; overflow: hidden; }
.chip-more { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* s: 幅が狭い */
.cal[data-size="s"] .cal-cell { padding: 4px 4px 5px; gap: 3px; }
.cal[data-size="s"] .cal-cell-head { min-height: 22px; gap: 3px; }
.cal[data-size="s"] .cal-num { min-width: 22px; height: 22px; padding: 0 4px; font-size: 12px; }
.cal[data-size="s"] .cal-num small { display: none; }
.cal[data-size="s"] .cal-start { padding: 2px 4px; }
.cal[data-size="s"] .cal-start-text { display: none; } /* 旗だけ (説明はマウスを乗せると出る) */
.cal[data-size="s"] .chip { gap: 4px; padding: 1px 4px; font-size: 11px; }
.cal[data-size="s"] .chip-time { display: none; }
.cal[data-size="s"] .chip-more { padding: 0 4px; font-size: 10.5px; }
.cal[data-size="s"] .cal-weekdays span { padding: 6px; font-size: 11.5px; }
.cal[data-size="s"] .cal-add { width: 20px; height: 20px; }

/* xs: とても小さい: タスクは細いバー、開始はマスの右上の小さな旗 */
.cal[data-size="xs"] .cal-cell { padding: 3px 3px 4px; gap: 3px; }
.cal[data-size="xs"] .cal-cell-head { min-height: 18px; justify-content: center; position: static; }
.cal[data-size="xs"] .cal-num { min-width: 18px; height: 18px; padding: 0 3px; font-size: 11px; }
.cal[data-size="xs"] .cal-num small { display: none; }
.cal[data-size="xs"] .cal-start {
  position: absolute; top: 2px; right: 2px; z-index: 1; padding: 2px; border-radius: 5px; animation: none;
}
.cal[data-size="xs"] .cal-start-text { display: none; }
.cal[data-size="xs"] .cal-start .i { width: 9px; height: 9px; }
.cal[data-size="xs"] .cal-start .proj-icon.xs { width: 10px; height: 10px; font-size: 7px; }
.cal[data-size="xs"] .cal-add { display: none; }
.cal[data-size="xs"] .chip { height: 5px; padding: 0; border: 0; border-radius: 3px; background: var(--text-2); }
.cal[data-size="xs"] .chip > * { display: none; }
.cal[data-size="xs"] .chip.is-done { background: var(--success); }
.cal[data-size="xs"] .chip-more { padding: 0; font-size: 9.5px; line-height: 1.2; text-align: center; }
.cal[data-size="xs"] .cal-weekdays span { padding: 4px 2px; font-size: 10.5px; text-align: center; }
.cal[data-size="xs"] .cal-cell:hover .cal-num { transform: none; }

/* ============================================ 長い文字・多いデータでも崩れないように */
/* タグ: 名前を省略記号で (flex の中では text-overflow が効かないので名前を包む) */
.tag-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-more { --tag: #6b6b68; flex: none; }
.pop-tags .tag { max-width: 140px; }
/* ホームのタスク一覧: 作業中の人・完了した人の名前は行の幅の半分まで */
.wt-state { max-width: 45%; min-width: 0; overflow: hidden; }
.wt-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ラベル設定のプレビュー: 空白の無い長い文字も折り返す */
.wg-form .wf-preview { overflow-wrap: anywhere; }
/* アカウント設定: 長いニックネーム・ユーザー名 */
.prof-who > div { min-width: 0; }
.prof-who .am-name, .prof-who .am-user { overflow-wrap: anywhere; }
/* 見出し: 空白の無い長い名前 (プロジェクト名など) でも折り返して、画面からはみ出さない */
.page-title, .ps-card-title, .modal-head h2, .timer-title, .fc-title { overflow-wrap: anywhere; }
.ps-head > div { min-width: 0; }
/* 管理者設定: 狭い画面の 1 列でも、長い名前・メールで列が広がらない */
.ad-two > * { min-width: 0; }
@media (max-width: 960px) { .ad-two { grid-template-columns: minmax(0, 1fr); } }

/* ============================================ ウィジェット: 次のタスク / いま作業中 / ヒートマップ / リンク / 動画 / 締切 */
.wg-menu { width: min(580px, calc(100vw - 32px)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 2px; }
.wg-empty small { display: block; margin-top: 4px; font-size: 11.5px; }
.wg-empty > .i { display: block; width: 26px; height: 26px; margin: 0 auto 6px; stroke-width: 1.5; }

.wgc-next { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding: 2px 16px 12px; overflow: hidden; }
.wn-big { font-size: clamp(18px, 8cqi, 26px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wn-big.is-now { color: var(--accent-line); }
.wn-when { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wn-title { margin-top: 6px; font-size: 14.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.wn-live { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-2); }
.wn-live > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wn-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wn-actions .btn .i { width: 14px; height: 14px; }
.wn-busy { width: 100%; font-size: 11.5px; color: var(--text-3); }
.wn-then { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--border); min-height: 0; overflow: hidden; }
.wn-then .wt-item { padding-inline: 0; }

.wl-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; width: 100%; padding: 8px 6px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.wl-item:hover { background: var(--bg-hover); }
.wl-item > .avatar-stack { grid-row: 1 / span 2; }
.wl-title { min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-time { grid-row: 1 / span 2; grid-column: 3; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wl-who { grid-column: 2; min-width: 0; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-bar { grid-column: 1 / -1; height: 3px; margin-top: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.wl-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .9s linear; }
.wl-item.is-paused .wl-time { color: var(--text-3); }
.wl-item.is-paused .wl-bar > span { background: var(--text-3); }

.wgc-hm { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 10px; overflow: hidden; }
.hm-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.hm-months, .hm-grid { display: grid; grid-template-columns: repeat(var(--weeks), var(--hc)); column-gap: 3px; }
.hm-months { height: 16px; font-size: 10.5px; color: var(--text-3); }
.hm-months span { grid-row: 1; white-space: nowrap; }
.hm-grid { grid-template-rows: repeat(7, var(--hc)); grid-auto-flow: column; row-gap: 3px; }
.hm-c { display: block; width: var(--hc, 10px); height: var(--hc, 10px); border-radius: 3px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent); }
.hm-c.l1 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: none; }
.hm-c.l2 { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); box-shadow: none; }
.hm-c.l3 { background: color-mix(in srgb, var(--accent) 72%, var(--surface)); box-shadow: none; }
.hm-c.l4 { background: var(--accent); box-shadow: none; }
.hm-c.is-today { box-shadow: inset 0 0 0 1.5px var(--text-2); }
.hm-c.is-future { visibility: hidden; }
.hm-foot { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 3px; height: 16px; margin-top: 6px; font-size: 10.5px; color: var(--text-3); }
.hm-foot .hm-c { --hc: 10px; }
.hm-foot > span:first-child { margin-right: 2px; } .hm-foot > span:last-child { margin-left: 2px; }

.wgc-links { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; gap: 6px; }
.wk-link {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none; transition: background-color .15s, border-color .15s;
}
.wk-link:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.wk-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-line); font-size: 13px; font-weight: 700; }
.wk-icon.is-yt { background: color-mix(in srgb, #e62117 12%, transparent); color: #e62117; }
.wk-icon .i { width: 16px; height: 16px; }
.wk-text { min-width: 0; display: flex; flex-direction: column; }
.wk-text b, .wk-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-text b { font-size: 13px; font-weight: 600; }
.wk-text small { font-size: 11px; color: var(--text-3); }

.wgc-video { flex: 1; min-height: 0; position: relative; background: #000; }
.wgc-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.wgc-cd { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: safe center; gap: 2px; padding: 14px 18px; overflow: hidden; }
.cd-name { font-size: 12.5px; font-weight: 600; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-countdown .wg-body, .wg-next .wg-body { container-type: inline-size; } /* 文字の大きさをウィジェットの幅に合わせる */
.cd-big { font-size: clamp(16px, 11cqi, 32px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cd-date { font-size: 12px; color: var(--text-3); }
.wgc-cd.is-soon .cd-big { color: var(--accent-line); }
.wgc-cd.is-over .cd-big { color: var(--text-3); }
.wgc-cd .wg-empty { margin: 6px 0 0; padding: 0; text-align: left; }

.wg-form .wf-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wg-form .wf-links:empty { display: none; }
.wg-form .wf-link { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 6px; align-items: center; }
.wg-form .wf-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.wg-form .field-hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.wg-form .field-hint.is-bad { color: var(--danger); }
@media (max-width: 640px) { .wg-menu { grid-template-columns: minmax(0, 1fr); } .wg-form .wf-link { grid-template-columns: minmax(0, 1fr) auto; } .wg-form .wf-link [name="lurl"] { grid-column: 1; } .wg-form .wf-link [data-rm-link] { grid-row: 1 / span 2; grid-column: 2; } }

/* ============================================ タスク一覧: 細いときは詰める */
.wg-tasks .wg-body { container-type: inline-size; }
@container (max-width: 210px) {
  .wg-tasks .wg-head { padding-inline: 10px; }
  .wg-tasks .wg-scroll { padding-inline: 4px; }
  .wg-tasks .wt-item { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 6px; padding-inline: 4px; }
  .wg-tasks .wt-time { font-size: 11px; }
  .wg-tasks .wt-who { display: none; }
  .wg-tasks .wt-group { margin-inline: 4px; }
}
@container (max-width: 150px) {
  .wg-tasks .wt-item { grid-template-columns: minmax(0, 1fr) auto; }
  .wg-tasks .wt-time { display: none; }
}

/* ============================================ 追加メニュー: ドラッグで置く */
.wg-menu-hint { grid-column: 1 / -1; padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; font-size: 11.5px; color: var(--text-3); }
.wg-menu-item:not(:disabled) { cursor: grab; }
.wg.is-outside { opacity: .45; }
.wg.is-outside .wg-body { box-shadow: var(--shadow-lg); }

/* ============================================ 画像の拡大表示 */
.home-board:not(.is-editing) .wg-image .wg-body img { cursor: zoom-in; }
html.iv-open { overflow: hidden; }
.img-view { position: fixed; inset: 0; z-index: 85; }
.iv-backdrop { position: absolute; inset: 0; background: rgba(12, 12, 14, .72); opacity: 0; transition: opacity .4s var(--ease), background-color .4s var(--ease); }
.img-view.open .iv-backdrop { opacity: 1; }
.img-view.is-full .iv-backdrop { background: rgba(0, 0, 0, .94); }
.iv-img {
  position: absolute; left: 0; top: 0; max-width: none; display: block; cursor: zoom-in; user-select: none; -webkit-user-select: none;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  transition: left .42s var(--ease), top .42s var(--ease), width .42s var(--ease), height .42s var(--ease), border-radius .42s var(--ease), opacity .3s;
}
.img-view.is-full .iv-img { cursor: zoom-out; box-shadow: none; }
.img-view.is-pan .iv-img { transition: left .14s linear, top .14s linear, width .42s var(--ease), height .42s var(--ease); }
@media (prefers-reduced-motion: reduce) { .iv-img, .iv-backdrop { transition-duration: .01s !important; } }

/* ============================================ 範囲選択・複数選択 */
.wg-marquee {
  position: absolute; left: 0; top: 0; z-index: 960; pointer-events: none; border-radius: 4px;
  border: 1px solid var(--accent-line); background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.home-board.is-editing { user-select: none; -webkit-user-select: none; }
.home-sel-info { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-line); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================ 画像ウィジェット: スライド */
.wgc-slides { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.wgc-slides .sl-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; visibility: hidden; }
.wgc-slides .sl-img.fit-contain { object-fit: contain; }
.wgc-slides .sl-img.on, .wgc-slides .sl-img.leaving { visibility: visible; }
.sl-nav {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; margin-top: -16px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .38); color: #fff; cursor: pointer; opacity: 0; transition: opacity .2s, background-color .15s;
}
.sl-nav.prev { left: 8px; } .sl-nav.next { right: 8px; }
.sl-nav .i { width: 18px; height: 18px; stroke-width: 2.4; }
.sl-nav:hover { background: rgba(0, 0, 0, .58); }
.wg-image:hover .sl-nav, .sl-nav:focus-visible { opacity: 1; }
.sl-dots { position: absolute; left: 0; right: 0; bottom: 8px; z-index: 2; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.sl-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); cursor: pointer; pointer-events: auto; transition: width .3s var(--ease), background-color .2s; }
.sl-dot.on { width: 18px; background: #fff; }
.sl-count { display: none; position: absolute; right: 8px; bottom: 8px; z-index: 2; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; }
.home-board.is-editing .sl-count { display: block; }
.home-board.is-editing .sl-nav, .home-board.is-editing .sl-dots { display: none; }
.wg-image .wg-body { contain: strict; }

/* 拡大表示: 前後の画像 */
.iv-nav {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; opacity: 0;
  transition: opacity .3s var(--ease), background-color .15s; backdrop-filter: blur(6px);
}
.iv-nav.prev { left: max(16px, env(safe-area-inset-left, 0px)); } .iv-nav.next { right: max(16px, env(safe-area-inset-right, 0px)); }
.iv-nav .i { width: 24px; height: 24px; stroke-width: 2.2; }
.iv-nav:hover { background: rgba(255, 255, 255, .26); }
.img-view.open .iv-nav { opacity: 1; }
.iv-count {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 2; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .3s var(--ease);
}
.img-view.open .iv-count { opacity: 1; }
.iv-img.no-tr { transition: none !important; }

/* 設定: 画像の一覧 */
.wg-form .wf-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; padding: 8px; border: 1.5px dashed var(--border); border-radius: 10px; min-height: 76px; transition: border-color .15s, background-color .15s; }
.wg-form .wf-imgs.is-drop { border-color: var(--accent-line); background: var(--accent-soft); }
.wg-form .wf-imgs-empty { grid-column: 1 / -1; align-self: center; text-align: center; font-size: 12.5px; color: var(--text-3); }
.wg-form .wf-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--bg-soft); cursor: grab; outline: 2px solid transparent; outline-offset: 1px; transition: outline-color .15s, opacity .15s; }
.wg-form .wf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.wg-form .wf-thumb.is-dragging { opacity: .4; }
.wg-form .wf-thumb.is-over { outline-color: var(--accent-line); }
.wg-form .wf-num { position: absolute; left: 4px; top: 4px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; }
.wg-form .wf-thumb-rm { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s; }
.wg-form .wf-thumb-rm .i { width: 12px; height: 12px; }
.wg-form .wf-thumb:hover .wf-thumb-rm, .wg-form .wf-thumb-rm:focus-visible { opacity: 1; }
.wg-form .wf-img-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.wg-form .wf-img-actions .field-hint { margin: 0; min-height: 0; }

/* ============================================ 設定: 通知・インストール */
.setting-actions { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.switch:disabled { opacity: .4; cursor: not-allowed; }
.setting-text { min-width: 0; }

/* ============================================ いつかやること */
.someday-card {
  margin-top: 22px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm); animation: fade-up .5s var(--ease) .13s both;
}
.someday-card .section-label { margin-bottom: 10px; }
.sd-add { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); transition: border-color .15s, background-color .15s; }
.sd-add:focus-within { border-style: solid; border-color: var(--accent-line); background: var(--bg-soft); }
.sd-add .i { width: 16px; height: 16px; flex: none; }
.sd-add input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; outline: none; box-shadow: none; }
.sd-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sd-list:empty { display: none; }
.sd-item { display: grid; grid-template-columns: 16px auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 6px 6px 2px; border-radius: var(--radius-sm); transition: background-color .15s, opacity .3s; }
.sd-item:hover { background: var(--bg-hover); }
.sd-list.is-compact .sd-item, .sd-item.is-done, .sd-list.no-sort .sd-item { grid-template-columns: auto minmax(0, 1fr) auto; padding-left: 6px; }
.sd-list.no-sort .sd-grip { display: none; }
.sd-grip { display: grid; place-items: center; width: 16px; height: 28px; color: var(--text-3); cursor: grab; opacity: 0; touch-action: none; transition: opacity .15s; }
.sd-grip .i { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.sd-item:hover .sd-grip, .sd-item.is-dragging .sd-grip { opacity: 1; }
.sd-item.is-dragging { position: relative; z-index: 2; background: var(--surface); box-shadow: var(--shadow-md); cursor: grabbing; }
.sd-check {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0; flex: none; border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: transparent; color: transparent; cursor: pointer; transition: border-color .15s, background-color .2s, color .15s, transform .25s var(--spring);
}
.sd-check .i { width: 12px; height: 12px; stroke-width: 3; }
button.sd-check:hover { border-color: var(--success); color: var(--success); }
button.sd-check:active { transform: scale(.88); }
.sd-check.is-on, .sd-item.is-completing .sd-check { border-color: var(--success); background: var(--success); color: #ffffff; }
.sd-item.is-completing { opacity: .5; }
.sd-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 2px 0; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
span.sd-main { cursor: default; }
.sd-title { font-size: 13.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.sd-item.is-doing .sd-title { font-weight: 600; }
.sd-item.is-done .sd-title { color: var(--text-3); text-decoration: line-through; }
.sd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; font-size: 11.5px; color: var(--text-3); }
.sd-doing { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-weight: 600; font-variant-numeric: tabular-nums; }
.sd-note { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-bar { display: block; height: 3px; margin-top: 4px; border-radius: 3px; background: var(--border); overflow: hidden; }
.sd-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .9s linear; }
.sd-bar.is-over > span { background: #E38A2E; }
.sd-act { flex: none; }
.sd-done-toggle { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 4px 8px 4px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font: inherit; font-size: 12.5px; cursor: pointer; }
.sd-done-toggle:hover { color: var(--text); background: var(--bg-hover); }
.sd-done-toggle .i { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.sd-list.is-done { margin-top: 2px; }
.sd-modal-info { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-3); }
.sd-modal-info:empty { display: none; }
#somedayModal textarea { width: 100%; box-sizing: border-box; }
/* 新規タスク: 種類の切り替え。「いつかやる」では開始日時・タグを出さない */
.task-kind { margin-bottom: 14px; }
#taskModal.is-someday .field-row, #taskModal.is-someday .tag-field, #taskModal.is-someday .memo-hint, #taskModal.is-someday #durationHint { display: none; }
.wg-someday .sd-list { margin-top: 0; }
.wg-someday .sd-item { padding-block: 5px; }

/* ============================================ 共有タイマーの超過 (開始した人が戻ってこない) */
.timer-card.is-overdue #timerState, .timer-dock.is-overdue #tdState { color: #c26a12; }
.tl-live.is-overdue .tl-live-time, .wl-item.is-overdue .wl-time { color: #c26a12; font-size: 12px; }
.tl-live.is-overdue .tl-live-dot { background: #E38A2E; animation: none; }
.tl-live.is-overdue .tl-live-who { color: #c26a12; font-weight: 600; }

/* ============================================ 管理者設定: バックアップ */
.bk-status-head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.bk-status-head .ad-pill.off { background: var(--bg-soft); color: var(--text-3); }
.bk-status-head .spacer { flex: 1; }
.bk-facts { margin-top: 14px; }
.bk-form .bk-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.bk-form .ad-form-foot { flex-wrap: wrap; }
.bk-enable { gap: 10px; }
.bk-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bk-history > li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px; align-items: start;
  padding: 10px 2px; border-top: 1px solid var(--border); font-size: 13px;
  animation: fade-right .35s var(--ease) both; animation-delay: calc(var(--i) * 25ms);
}
.bk-history > li:first-child { border-top: 0; }
.bk-history .bk-ico { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; }
.bk-history .bk-ico .i { width: 16px; height: 16px; }
.bk-history .ok .bk-ico { color: var(--success); }
.bk-history .error .bk-ico { color: var(--danger); }
.bk-history .running .bk-ico .i { animation: spin 1s linear infinite; color: var(--accent-line); }
.bk-line { display: flex; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.bk-line b { font-weight: 600; }
.bk-sub { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.bk-err { grid-column: 2 / -1; margin-top: 4px; color: var(--danger); font-size: 12px; overflow-wrap: anywhere; }
.bk-when { color: var(--text-3); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bk-empty { color: var(--text-3); font-size: 13px; }
.bk-what { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.bk-what code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--bg-soft); }
@media (max-width: 640px) {
  .bk-form .bk-two { grid-template-columns: 1fr 1fr; }
  .bk-form .ad-form-foot .btn { flex: 1; }
}

/* 長押しで編集: 押しているあいだ少し沈む (すぐ離す普通のクリックでは動かないよう、少し待ってから) */
.wg.is-pressing > .wg-body { transform: scale(.975); transition: transform .45s var(--ease) .15s; }
.home-board:not(.is-editing) .wg { -webkit-touch-callout: none; }

/* ============================================ プラン・請求情報 */
.bl-view { max-width: 880px; }
.bl-head-icon { background: var(--accent); color: var(--accent-fg); }
.bl-body { display: flex; flex-direction: column; gap: 18px; }
.bl-body > * { animation: fade-up .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.bl-current { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; }
.bl-current-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bl-label { font-size: 12px; color: var(--text-3); }
.bl-plan-name { font-size: 30px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.bl-plan-desc { grid-column: 1; margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.bl-price { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-variant-numeric: tabular-nums; }
.bl-price b { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.bl-price span { margin-left: 4px; font-size: 13px; color: var(--text-3); }
.bl-usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bl-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bl-plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.bl-plan.is-current { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.bl-plan.is-soon { border-style: dashed; background: var(--bg-soft); color: var(--text-2); }
.bl-plan-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bl-plan-title h3 { margin: 0; font-size: 16px; font-weight: 700; }
.bl-plan-title .bl-p { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bl-plan .bl-tag { align-self: flex-start; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-line); }
.bl-plan.is-soon .bl-tag { background: var(--surface); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border); }
.bl-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.bl-feats li { display: flex; gap: 8px; align-items: flex-start; }
.bl-feats .i { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--success); }
.bl-soon-text { margin: 0; font-size: 13px; line-height: 1.6; }
.bl-empty { color: var(--text-3); }
@media (max-width: 640px) {
  .bl-current { grid-template-columns: 1fr; }
  .bl-price { grid-column: 1; grid-row: auto; text-align: left; }
  .bl-usage { grid-template-columns: 1fr; }
  .bl-plans { grid-template-columns: 1fr; }
}
.bl-note { margin: 16px 0 0; }

/* ============================================ 通知 */
.notif-btn { position: relative; }
.notif-btn .i { transform-origin: 50% 10%; }
.notif-btn.is-ring .i { animation: bell-ring .9s var(--ease); }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
.notif-badge {
  position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; animation: pop .35s var(--spring);
}
.notif-menu {
  position: fixed; z-index: 45; width: min(380px, calc(100vw - 16px)); display: flex; flex-direction: column;
  max-height: min(560px, calc(100vh - 80px)); border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity .15s var(--ease), transform .2s var(--ease);
}
.notif-menu.open { opacity: 1; transform: none; transition: opacity .2s var(--ease), transform .35s var(--spring); }
.nt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 8px 16px; border-bottom: 1px solid var(--border); }
.nt-title { margin: 0; font-size: 14px; font-weight: 650; }
.nt-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.nt-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 8px; gap: 10px; align-items: start; width: 100%;
  padding: 10px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left;
  font: inherit; cursor: pointer; transition: background-color .15s;
}
.nt-item:hover, .nt-item:focus-visible { background: var(--bg-hover); outline: none; }
.nt-item.is-unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.nt-item.is-unread:hover { background: color-mix(in srgb, var(--accent) 11%, transparent); }
.nt-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-soft); color: var(--text-2); }
.nt-ico .i { width: 15px; height: 15px; }
.nt-ico.k-join, .nt-ico.k-ended { background: var(--accent-soft); color: var(--accent-line); }
.nt-ico.k-team_added, .nt-ico.k-role_changed { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.nt-ico.k-backup_failed { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.nt-ico.k-announce { background: var(--ink); color: var(--ink-fg); }
.nt-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-text { font-size: 13px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.nt-text b { color: var(--text); font-weight: 600; }
.nt-body { font-size: 12.5px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nt-item.is-open .nt-body { display: block; -webkit-line-clamp: unset; }
.nt-time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nt-dot { width: 8px; height: 8px; margin-top: 11px; border-radius: 50%; background: var(--accent-line); }
.nt-item:not(.is-unread) .nt-dot { visibility: hidden; }
.nt-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.nt-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.nt-empty .i { width: 28px; height: 28px; opacity: .6; }
.nt-empty b { color: var(--text-2); font-weight: 600; }
.nt-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 8px; border-top: 1px solid var(--border); }
.nt-link { border: 0; background: none; padding: 6px 8px; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer; border-radius: 6px; }
.nt-link:hover { color: var(--text); background: var(--bg-hover); }
.nt-list > li { animation: fade-up .25s var(--ease) both; animation-delay: calc(min(var(--i, 0), 10) * 18ms); }
/* 設定: 種類ごとのオン・オフ */
.setting.setting-col { flex-direction: column; align-items: stretch; gap: 8px; }
.nt-prefs { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 0 2px; }
.nt-pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.nt-pref .switch { transform: scale(.85); transform-origin: right center; }
/* 管理者: お知らせ */
.an-form { display: flex; flex-direction: column; gap: 12px; }
.an-form textarea { resize: vertical; min-height: 90px; }
.an-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.an-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 2px; border-top: 1px solid var(--border); }
.an-list > li:first-child { border-top: 0; }
.an-list .an-t { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.an-list .an-b { grid-column: 1; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.an-list .an-m { grid-column: 1; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.an-list .an-del { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
.an-empty { color: var(--text-3); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .notif-btn.is-ring .i { animation: none; } }

/* ============================================ アプリとしてインストール */
.ig-hero { display: flex; align-items: center; gap: 14px; }
.ig-hero img { width: 52px; height: 52px; border-radius: 13px; box-shadow: var(--shadow-sm); flex: none; }
.ig-hero b { display: block; font-size: 16px; font-weight: 700; }
.ig-hero span { font-size: 12.5px; color: var(--text-2); }
.ig-env { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.ig-env b { color: var(--text); font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--bg-soft); }
.ig-steps { margin: 0; padding: 0; list-style: none; counter-reset: ig; display: flex; flex-direction: column; gap: 10px; }
.ig-steps li { counter-increment: ig; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13.5px; line-height: 1.6; }
.ig-steps li::before {
  content: counter(ig); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ig-steps b { font-weight: 600; }
.ig-key { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; margin: 0 2px; vertical-align: -5px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.ig-key .i { width: 14px; height: 14px; }
.ig-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.ig-other { border-top: 1px solid var(--border); padding-top: 12px; font-size: 13px; }
.ig-other summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
.ig-other summary:hover { color: var(--text); }
.ig-other-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.ig-other h4 { margin: 0 0 6px; font-size: 12.5px; font-weight: 650; }
.ig-other .ig-steps li { font-size: 12.5px; grid-template-columns: 20px minmax(0, 1fr); }
.ig-other .ig-steps li::before { width: 20px; height: 20px; font-size: 11px; background: var(--bg-soft); color: var(--text-2); }

/* ログイン画面: 法的表記へのリンク */
.login-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-bottom: 6px; }
.login-links a { color: var(--text-3); text-decoration: none; }
.login-links a:hover { color: var(--text-2); text-decoration: underline; }
/* 管理者設定: 事業者情報 */
.biz-wide { grid-column: 1 / -1; }
@media (max-width: 640px) { #bizForm { grid-template-columns: 1fr; } }
