/* =========================================================
   見た目の設定（色・大きさ・並べ方）
   色は最初の :root にまとめています。ここを変えると全体の色が変わります
   ========================================================= */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #1d2330;
  --muted: #6b7385;
  --accent: #4f6bed;
  --accent-weak: #e8ecfd;
  --accent-text: #ffffff;
  --danger: #d64545;
  --danger-weak: #fdecec;
  --ok: #2f9e6a;
  --ok-weak: #e3f5ec;
  --warn: #d9822b;
  --warn-weak: #fdf1e3;
  --grid: rgba(0, 0, 0, 0.06);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --pj-bg: 92%;
  --pj-fg: 32%;
  --bar-l: 58%;
  --radius: 10px;
  --rm-name: 240px;
  --border-strong: #cdd2db;
  --accent-grad: var(--accent);
  --accent-glow: rgba(79, 107, 237, 0.3);
  --radius-lg: 12px;
  /* イラストの色 */
  --il-line: #2d3142; --il-paper: #ffffff; --il-soft: #e8edf5;
  --il-1: #2ab3a6; --il-2: #f5b82e; --il-3: #ef7d57; --il-4: #6c8cc8;
  color-scheme: light;
}
/* 暗いテーマ（端末の設定に合わせる） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b; --surface: #1c1f26; --surface-2: #252932; --border: #2f343e;
    --text: #e6e8ee; --muted: #9aa1b2; --accent: #7b93ff; --accent-weak: #283157; --accent-text: #0d1020;
    --danger: #ff6b6b; --danger-weak: #3a2224; --ok: #4cc38a; --ok-weak: #1d3329; --warn: #f0a050; --warn-weak: #3a2c1c;
    --grid: rgba(255, 255, 255, 0.06); --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    --pj-bg: 24%; --pj-fg: 82%; --bar-l: 48%;
    --il-line: #c9d1e0; --il-paper: #2a2f3a; --il-soft: #353c4a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b; --surface: #1c1f26; --surface-2: #252932; --border: #2f343e;
  --text: #e6e8ee; --muted: #9aa1b2; --accent: #7b93ff; --accent-weak: #283157; --accent-text: #0d1020;
  --danger: #ff6b6b; --danger-weak: #3a2224; --ok: #4cc38a; --ok-weak: #1d3329; --warn: #f0a050; --warn-weak: #3a2c1c;
  --grid: rgba(255, 255, 255, 0.06); --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --pj-bg: 24%; --pj-fg: 82%; --bar-l: 48%;
  --il-line: #c9d1e0; --il-paper: #2a2f3a; --il-soft: #353c4a;
  color-scheme: dark;
}

/* 列の色 */
.c-gray { --cc: #8a93a6; } .c-blue { --cc: #4f8ff7; } .c-green { --cc: #3bb07a; } .c-yellow { --cc: #e2b93b; }
.c-orange { --cc: #ef8a3c; } .c-red { --cc: #e5534b; } .c-purple { --cc: #9a6bf0; } .c-pink { --cc: #e46aa6; }

/* ---------- 基本 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .35; cursor: default; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; }
.rot90 svg { transform: rotate(90deg); }

/* ---------- ボタン・入力欄 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-weak); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn .ic { width: 16px; height: 16px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.tiny { width: 22px; height: 22px; }
.icon-btn.tiny .ic { width: 14px; height: 14px; }
.text-input, select, input[type="date"] {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.text-input { width: 100%; }
.text-input:focus, select:focus, input[type="date"]:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.inline { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* 切り替えボタンのまとまり */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { padding: 4px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.seg.small button { padding: 2px 10px; font-size: 12px; }

/* 小さなラベル */
.chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; white-space: nowrap; line-height: 1.6;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip .ic { width: 12px; height: 12px; }
.chip.tag { color: var(--accent); background: var(--accent-weak); }
.chip.proj { background: hsl(var(--h, 220) 60% var(--pj-bg)); color: hsl(var(--h, 220) 45% var(--pj-fg)); }
.chip.due.over { background: var(--danger-weak); color: var(--danger); font-weight: 600; }
.chip.due.today, .chip.today { background: var(--warn-weak); color: var(--warn); font-weight: 600; }
.chip.due.soon { color: var(--warn); }
.chip.ok, .chip.prog.all { background: var(--ok-weak); color: var(--ok); }
.chip.ghost { background: transparent; padding: 0 2px; }
.chip.col { background: color-mix(in srgb, var(--cc) 18%, transparent); color: var(--text); }
.chip.prio.p3 { background: var(--danger-weak); color: var(--danger); }
.chip.prio.p2 { background: var(--warn-weak); color: var(--warn); }
.chip.on { background: var(--accent); color: var(--accent-text); }
button.chip { cursor: pointer; }
.prio-flag { color: var(--danger); width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

/* 進み具合のバー */
.pbar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 48px; }
.pbar-fill { height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }

/* ---------- 画面の枠 ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; height: 100vh; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--border);
  background: var(--surface); min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 14px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.on { background: var(--accent-weak); color: var(--accent); }
.sync { padding: 10px 10px 0; font-size: 12px; }
.sync-in { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.sync-in.off { color: var(--warn); }
.sync-in.local { color: var(--muted); }
.sync-in .ic { width: 15px; height: 15px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: flex-start; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: relative; z-index: 5;
}
.view-title { font-size: 18px; margin: 4px 0 0; white-space: nowrap; min-width: 96px; }
.view { flex: 1; overflow: auto; padding: 16px 20px 40px; min-height: 0; }
.bottom-nav, .fab, .only-mobile { display: none !important; }

/* ---------- 1行入力 ---------- */
.qi { position: relative; min-width: 0; }
.qi-row {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 6px 0 12px; transition: box-shadow .2s, border-color .2s;
}
.qi-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.qi-row.pulse { animation: pulse .55s ease; }
.qi-icon { color: var(--accent); width: 17px; height: 17px; }
.qi-input { flex: 1; border: 0; background: transparent; padding: 9px 0; outline: none; min-width: 0; }
.qi-add {
  display: none; background: var(--accent-grad); color: var(--accent-text); padding: 5px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; flex: none; animation: fade .15s;
}
.qi-add.show { display: inline-block; }
.top-qi { flex: 1; max-width: 720px; }
.qi.big .qi-row { padding: 3px 8px 3px 16px; border-radius: 14px; }
.qi.big .qi-input { padding: 12px 0; font-size: 15.5px; }
.qi.big .qi-icon { width: 20px; height: 20px; }

/* 入力欄の下のボタン（期限・タグ・プロジェクト・優先度） */
.qi-drawer { display: none; flex-direction: column; gap: 8px; padding-top: 8px; }
.qi.tools-always .qi-drawer, .qi.active .qi-drawer { display: flex; }
.top-qi .qi-drawer {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; padding: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 30; animation: drop .16s ease;
}
.qi-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qi-tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px;
  border: 1px dashed var(--border-strong); color: var(--muted); background: var(--surface); max-width: 100%;
  transition: transform .15s, color .15s, background .15s, border-color .15s;
}
.qi-tool span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-tool .ic { width: 15px; height: 15px; }
.qi-tool:hover { color: var(--text); border-style: solid; transform: translateY(-1px); }
.qi-tool.open { border-style: solid; border-color: var(--accent); color: var(--accent); }
.qi-tool.set { border: 1px solid transparent; font-weight: 700; }
.qi-tool.t-due.set { background: var(--warn-weak); color: var(--warn); }
.qi-tool.t-tag.set { background: var(--accent-weak); color: var(--accent); }
.qi-tool.t-project.set { background: var(--ok-weak); color: var(--ok); }
.qi-tool.t-prio.set { background: var(--danger-weak); color: var(--danger); }
.qi-tool.t-help { margin-left: auto; border-color: transparent; background: transparent; }
.qi-panel { background: var(--surface-2); border-radius: var(--radius); padding: 10px; animation: drop .16s ease; }
.qi-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.preset {
  background: var(--surface); border-radius: 10px; padding: 7px 4px; display: flex; flex-direction: column; align-items: center;
  border: 1px solid var(--border); transition: transform .12s, border-color .12s;
}
.preset b { font-size: 13px; }
.preset small { color: var(--muted); font-size: 10.5px; }
.preset:hover { border-color: var(--accent); transform: translateY(-1px); }
.preset.on { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }
.qi-dates { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qi-dates label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.qi-taglist, .qi-projects { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-chip {
  padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--accent);
  font-size: 13px; font-weight: 600; transition: transform .12s;
}
.pick-chip:hover { transform: translateY(-1px); }
.pick-chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.qi-newtag { display: flex; gap: 6px; margin-top: 8px; }
.pj-opt {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); font-size: 13px;
}
.pj-dot { width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h, 220) 62% var(--bar-l)); }
.pj-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); font-weight: 700; }
.qi-prio { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prio-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); transition: transform .12s;
}
.prio-opt:hover { transform: translateY(-1px); }
.prio-opt .ic { width: 16px; height: 16px; }
.prio-opt b { font-size: 15px; }
.prio-opt small { font-size: 10px; color: var(--muted); }
.prio-opt.p3 { color: var(--danger); }
.prio-opt.p2 { color: var(--warn); }
.prio-opt.p1 { color: var(--muted); }
.prio-opt.on { border-color: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent); }
.qi-preview { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qi-preview-label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.lane-add .qi-presets { grid-template-columns: repeat(3, 1fr); }
.lane-add .qi-prio small { display: none; }

/* ---------- 共通の部品 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 280px; }
.search {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 0 10px; color: var(--muted);
}
.search .ic { width: 15px; height: 15px; }
.search-input { border: 0; background: transparent; padding: 7px 0; outline: none; width: 160px; color: var(--text); }
.search:focus-within { border-color: var(--accent); }
.empty { text-align: center; padding: 48px 16px; color: var(--text); }
.empty-emoji { font-size: 36px; margin-bottom: 8px; }
.empty p { margin: 4px auto; max-width: 440px; }
.count { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 0 7px; margin-left: 6px; font-weight: 500; }

/* チェック付きの行 */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: 8px; }
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.row-title { overflow-wrap: anywhere; }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.row-meta:empty { display: none; }
.row.done .row-title, .card.done .card-title, .tnode.done .tnode-title > span:first-of-type { text-decoration: line-through; color: var(--muted); }
.check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center;
  color: transparent; flex: none; margin-top: 1px; transition: background .15s, border-color .15s;
}
.check .ic { width: 12px; height: 12px; }
.check:hover { border-color: var(--ok); color: var(--ok); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- 今日 ---------- */
.today-view { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.today-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.today-date { font-size: 28px; font-weight: 700; line-height: 1.1; }
.today-date small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.today-stats { display: flex; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; text-align: center; min-width: 64px; }
.stat b { display: block; font-size: 20px; line-height: 1.2; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.over b { color: var(--danger); }
.stat.ok b { color: var(--ok); }
.today-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 10px 6px; }
.today-sec h3 { margin: 2px 6px 6px; font-size: 13px; display: flex; align-items: center; }
.today-sec.over h3 { color: var(--danger); }
.today-sec.ok h3 { color: var(--ok); }

/* ---------- ボード ---------- */
body[data-view="board"] .view, body[data-view="roadmap"] .view { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 12px; }
.board { flex: 1; display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; min-height: 0; padding-bottom: 8px; }
.lane {
  flex: 0 0 288px; max-height: 100%; display: flex; flex-direction: column; background: var(--surface-2);
  border-radius: 12px; padding: 8px; border-top: 3px solid var(--cc, transparent); min-height: 0;
}
.lane-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px 8px; font-weight: 600; }
.lane-dot, .col-item .lane-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc); flex: none; margin-right: 4px; }
.lane-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-scroll { overflow-y: auto; min-height: 0; flex: 1; margin: 0 -4px; padding: 0 4px; }
.lane-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; padding-bottom: 4px; }
.lane-add { margin-top: 6px; }
.lane-add .qi-row { background: transparent; border-color: transparent; }
.lane-add .qi-row:focus-within, .lane-add .qi-row:hover { background: var(--surface); border-color: var(--border); }
.lane.add-lane { background: transparent; border: 2px dashed var(--border); border-top-width: 2px; }
.lane.onboarding { flex-basis: 340px; background: var(--surface); border: 1px solid var(--border); padding: 18px; gap: 10px; }
.lane.onboarding h3 { margin: 0; }
.lane.onboarding p { margin: 0; }
.col-adder { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--surface); border-radius: 9px; padding: 9px 11px; box-shadow: var(--shadow); cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  border-left: 3px solid transparent;
}
.card:hover { box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.card.p3 { border-left-color: var(--danger); }
.card.p2 { border-left-color: var(--warn); }
.card.p1 { border-left-color: var(--muted); }
.card-title { overflow-wrap: anywhere; font-weight: 500; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card.done { opacity: .65; }
.card-ghost { opacity: .35; }
.card-chosen { box-shadow: var(--shadow-lg); }
.card-drag { transform: rotate(2deg); }

/* ---------- ツリー ---------- */
.tree { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.tnode {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px calc(8px + var(--depth, 0) * 26px);
  border-radius: 8px; min-height: 40px; position: relative;
}
.tnode:hover { background: var(--surface-2); }
.tnode.root { margin-top: 6px; font-weight: 600; }
.tnode.root::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: hsl(var(--h) 60% var(--bar-l));
}
.tnode .check { margin-top: 0; }
.twisty, .twisty-space { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--muted); }
.twisty .ic { width: 16px; height: 16px; transition: transform .15s; }
.twisty.open .ic { transform: rotate(90deg); }
.tnode-title { flex: 1; min-width: 0; text-align: left; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.tprog { display: inline-flex; align-items: center; gap: 6px; width: 110px; flex: none; }
.tprog .pbar { flex: 1; }
.tnode.adding { padding-top: 2px; padding-bottom: 6px; }
.tnode.adding .qi { flex: 1; }

/* ---------- カレンダー ---------- */
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-title { margin: 0 6px; font-size: 18px; min-width: 120px; text-align: center; }
.cal-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.cal-wd { background: var(--surface); text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; font-weight: 600; }
.cal-wd.sun, .cal-cell.sun .cal-num { color: var(--danger); }
.cal-wd.sat, .cal-cell.sat .cal-num { color: #4f8ff7; }
.cal-cell { background: var(--surface); min-height: 104px; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: var(--bg); }
.cal-cell.out .cal-num { opacity: .45; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-text) !important; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-height: 18px; flex: 1; }
.cal-chip {
  font-size: 11.5px; padding: 1px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: hsl(var(--h) 60% var(--pj-bg)); color: hsl(var(--h) 45% var(--pj-fg)); border-left: 3px solid hsl(var(--h) 60% var(--bar-l));
}
.cal-chip.over { background: var(--danger-weak); color: var(--danger); border-left-color: var(--danger); }
.cal-chip.done { opacity: .5; text-decoration: line-through; }
.cal-dots { display: none; }
.cal-agenda { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.cal-agenda h3 { margin: 0; display: flex; gap: 8px; align-items: center; }
.cal-agenda h4 { margin: 8px 0 2px; }

/* ---------- ロードマップ ---------- */
.rm-scroll { flex: 1; overflow: auto; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.rm-body { position: relative; min-height: 100%; }
.rm-row { display: flex; height: 38px; border-bottom: 1px solid var(--grid); }
.rm-row.top { border-top: 1px solid var(--border); }
.rm-name {
  position: sticky; left: 0; z-index: 2; width: var(--rm-name); flex: none; background: var(--surface);
  display: flex; align-items: center; gap: 4px; padding: 0 8px 0 calc(6px + var(--depth, 0) * 16px);
  border-right: 1px solid var(--border); min-width: 0;
}
.rm-title { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-row.top .rm-title { font-weight: 600; }
.rm-title.done { text-decoration: line-through; color: var(--muted); }
.rm-track { position: relative; flex: none; height: 100%; }
.rm-head { position: sticky; top: 0; z-index: 4; height: 46px; background: var(--surface); border-bottom: 1px solid var(--border); }
.rm-head .rm-name { z-index: 5; font-size: 12px; color: var(--muted); font-weight: 600; }
.rm-scale { position: relative; height: 100%; }
.rm-month { position: absolute; top: 4px; font-size: 12px; font-weight: 700; padding-left: 4px; border-left: 1px solid var(--border); white-space: nowrap; }
.rm-tick { position: absolute; bottom: 3px; font-size: 10px; color: var(--muted); transform: translateX(2px); }
.rm-tick.mon { color: var(--text); }
.rm-weekend { position: absolute; top: 24px; bottom: 0; background: var(--grid); }
.rm-group .rm-name { font-weight: 700; font-size: 12px; color: var(--muted); background: var(--surface-2); }
.rm-group { background: var(--surface-2); }
.rm-bar {
  position: absolute; top: 8px; height: 22px; border-radius: 6px; background: hsl(var(--h) 62% var(--bar-l));
  color: #fff; font-size: 12px; text-align: left; padding: 0 8px; display: flex; align-items: center; z-index: 1;
  box-shadow: var(--shadow);
}
.rm-bar.top { top: 7px; height: 24px; font-weight: 600; }
.rm-bar.summary { top: 13px; height: 12px; background: repeating-linear-gradient(45deg, hsl(var(--h) 55% var(--bar-l)) 0 6px, hsl(var(--h) 55% calc(var(--bar-l) + 10%)) 6px 12px); }
.rm-bar.done { opacity: .45; }
.rm-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-bar-label.outside { position: absolute; left: calc(100% + 6px); color: var(--text); overflow: visible; }
.rm-bar.summary .rm-bar-label { position: absolute; left: calc(100% + 6px); color: var(--muted); font-weight: 500; overflow: visible; }
.rm-ms {
  position: absolute; top: 12px; width: 14px; height: 14px; transform: translateX(-7px) rotate(45deg);
  background: hsl(var(--h) 62% var(--bar-l)); border-radius: 2px; z-index: 1;
}
.rm-ms.done { opacity: .45; }
.rm-ms-label { position: absolute; left: 14px; top: -10px; transform: rotate(-45deg); transform-origin: left top; white-space: nowrap; font-size: 12px; color: var(--text); }
.rm-nodate { position: absolute; top: 9px; white-space: nowrap; cursor: pointer; }
.rm-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; z-index: 3; pointer-events: none; }

/* ---------- アイデア ---------- */
.ideas { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.idea-grid { columns: 260px; column-gap: 12px; }
.idea {
  break-inside: avoid; margin-bottom: 12px; background: hsl(var(--h) 70% calc(var(--pj-bg) + 3%)); border-radius: 12px;
  border: 1px solid hsl(var(--h) 40% calc(var(--pj-bg) - 8%)); display: flex; flex-direction: column; overflow: hidden;
}
.idea-body { text-align: left; padding: 12px 14px 6px; display: flex; flex-direction: column; gap: 6px; }
.idea-title { font-weight: 600; overflow-wrap: anywhere; }
.idea-note { font-size: 13px; color: var(--muted); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.idea-foot { display: flex; align-items: center; gap: 6px; padding: 6px 10px 10px 14px; flex-wrap: wrap; }
.idea-foot .btn { background: var(--surface); }

/* ---------- 設定 ---------- */
.settings { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.set-card h3 { margin: 0; font-size: 15px; }
.set-card p { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.col-list { display: flex; flex-direction: column; gap: 4px; }
.col-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.col-item .chip { margin-left: 6px; }
.inline-form { display: flex; gap: 8px; }
.syntax { border-collapse: collapse; width: 100%; }
.syntax td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.syntax code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; white-space: nowrap; }

/* ---------- 詳細パネル ---------- */
.panel-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 25, 0); transition: background .2s; }
.panel-backdrop.open { background: rgba(10, 14, 25, .32); }
.panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--surface); overflow-y: auto;
  box-shadow: var(--shadow-lg); padding: 0 20px 24px; transform: translateX(100%); transition: transform .22s ease;
  display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain;
}
.panel-backdrop.open .panel { transform: none; }
.panel-head { position: sticky; top: 0; background: var(--surface); z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; border-bottom: 1px solid var(--border); }
.crumbs { flex: 1; display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; font-size: 12px; }
.crumb { color: var(--accent); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb::after { content: " ›"; color: var(--muted); }
.panel-title { font-size: 20px; font-weight: 700; border: 0; background: transparent; resize: none; width: 100%; padding: 4px 0; outline: none; overflow: hidden; line-height: 1.4; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.field-row { display: flex; align-items: center; gap: 12px; }
.field-label { width: 64px; flex: none; color: var(--muted); font-size: 12.5px; }
.field-ctl { flex: 1; min-width: 0; display: flex; }
.field-ctl select { max-width: 100%; }
.status-line, .date-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.done-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.date-wrap { display: inline-flex; align-items: center; gap: 2px; }
.seg .p3.on { color: var(--danger); }
.seg .p2.on { color: var(--warn); }
.section h3 { font-size: 13px; margin: 0 0 6px; }
.note { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; background: var(--surface); min-height: 80px; line-height: 1.6; }
.section .pbar { margin-bottom: 6px; }
.section .qi { margin-top: 6px; }
.panel-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.inline { flex-direction: row; align-items: center; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--cc); border: 3px solid transparent; }
.swatch.on { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }

/* ---------- ダイアログ ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 25, .36); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-backdrop.closing { opacity: 0; transition: opacity .15s; }
.modal { background: var(--surface); border-radius: 14px; width: min(520px, 100%); max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; padding: 12px 12px 4px 18px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 16px; }
.modal-body { padding: 8px 18px 18px; }
.modal-body p { margin: 0 0 10px; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- お知らせ ---------- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast {
  background: #222833; color: #fff; padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px; pointer-events: auto; animation: fade .2s; transition: opacity .3s, transform .3s; font-size: 13px;
}
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast-btn { color: #9fb2ff; font-weight: 700; }

/* ---------- ログイン ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; box-shadow: var(--shadow); }
.login-card img { align-self: center; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; }
.login-card .btns { justify-content: center; }
.or { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-msg { color: var(--danger); font-size: 13px; min-height: 1em; }

/* =========================================================
   スマホ・小さい画面（幅 860px 未満）
   ========================================================= */
@media (max-width: 859px) {
  :root { --rm-name: 132px; }
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .top-qi { display: none; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); align-items: center; justify-content: space-between; }
  .view-title { margin: 0; }
  .view { padding: 12px 12px calc(90px + env(safe-area-inset-bottom)); }
  body[data-view="board"] .view, body[data-view="roadmap"] .view { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item { flex: 1; flex-direction: column; gap: 1px; padding: 6px 0 4px; font-size: 10.5px; border-radius: 10px; }
  .bottom-nav .nav-item .ic { width: 22px; height: 22px; }
  .bottom-nav .nav-item.on { background: transparent; }
  .fab {
    display: grid !important; place-items: center; position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-text); z-index: 21; box-shadow: var(--shadow-lg);
  }
  .fab .ic { width: 26px; height: 26px; }
  body[data-view="settings"] .fab { display: none !important; }
  .hide-sm { display: none; }

  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; }
  .search-input { width: 100%; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .toolbar .inline { flex: none; }

  .board { scroll-snap-type: x mandatory; gap: 10px; margin: 0 -12px; padding: 0 12px 8px; scroll-padding: 12px; }
  .lane { flex-basis: 84vw; scroll-snap-align: start; }
  .card { padding: 11px 12px; }

  .tnode { padding-left: calc(4px + var(--depth, 0) * 16px); gap: 6px; }
  .tprog { width: 64px; }
  .tprog .small { display: none; }
  .tnode .chip.col { display: none; }

  .cal-wrap { grid-template-columns: 1fr; }
  .cal-cell { min-height: 54px; align-items: center; padding: 3px 1px; }
  .cal-items { display: none; }
  .cal-dots { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: center; }
  .cal-dots .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
  .cal-dots .dot.done { background: var(--muted); opacity: .5; }
  .cal-dots .more { font-size: 9px; color: var(--muted); }
  .cal-agenda { position: static; }

  .panel { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
  .panel-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .field-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .field-label { width: auto; }

  .modal-backdrop.sheet { place-items: end stretch; padding: 0; }
  .modal-backdrop.sheet .modal { width: 100%; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up .2s ease; }
  #toast-root { bottom: calc(140px + env(safe-area-inset-bottom)); }
  .today-date { font-size: 24px; }
  .stat { min-width: 0; padding: 6px 8px; flex: 1; }
  .today-stats { width: 100%; }
  .idea-grid { columns: 1; }
}
@keyframes up { from { transform: translateY(100%); } }

/* タッチ操作の端末ではホバー表示を控えめに */
@media (hover: none) {
  .row:hover, .tnode:hover, .cal-cell:hover { background: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* =========================================================
   かんたん入力のコツ（ヒント画面）
   ========================================================= */
.tips-lead { font-size: 14px; line-height: 1.75; margin: 0 0 4px !important; }
.tips-lead b { color: var(--accent); }
.tip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.tip { display: flex; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.tip-emoji {
  font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface);
  border-radius: 13px; flex: none; box-shadow: var(--shadow);
}
.tip-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tip-body b { font-size: 14px; }
.tip-examples { display: flex; flex-wrap: wrap; gap: 4px; }
.tip code, .tip-example code {
  background: var(--accent-weak); color: var(--accent); padding: 2px 9px; border-radius: 999px;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
}
.tip small { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.tip-example { border: 1.5px dashed var(--border-strong); border-radius: 16px; padding: 10px 14px; }
.tip-example small { color: var(--muted); }
.tip-example > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-weight: 700; }
@media (max-width: 560px) { .tip-grid { grid-template-columns: 1fr; } }

/* 着せ替えの選択 */
.style-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.style-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface); text-align: left;
}
.style-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.style-opt small { color: var(--muted); font-size: 11.5px; }
.style-swatch { display: flex; gap: 4px; margin-bottom: 4px; }
.style-swatch i { width: 22px; height: 22px; border-radius: 7px; }
.s-pop .style-swatch i:nth-child(1) { background: #7c3aed; } .s-pop .style-swatch i:nth-child(2) { background: #ec4899; } .s-pop .style-swatch i:nth-child(3) { background: #f59e0b; }
.s-neon .style-swatch i:nth-child(1) { background: #06070d; box-shadow: inset 0 0 0 1px #22d3ee; } .s-neon .style-swatch i:nth-child(2) { background: #22d3ee; box-shadow: 0 0 8px #22d3ee; } .s-neon .style-swatch i:nth-child(3) { background: #a855f7; box-shadow: 0 0 8px #a855f7; }
.s-sport .style-swatch i:nth-child(1) { background: #1e40af; } .s-sport .style-swatch i:nth-child(2) { background: #06b6d4; } .s-sport .style-swatch i:nth-child(3) { background: #f97316; }
.s-gadget .style-swatch i:nth-child(1) { background: #15181d; } .s-gadget .style-swatch i:nth-child(2) { background: #ff6a00; } .s-gadget .style-swatch i:nth-child(3) { background: #f3f4f6; box-shadow: inset 0 0 0 1px #c5cad2; }
.s-modern .style-swatch i:nth-child(1) { background: #fff; box-shadow: inset 0 0 0 1px #d1d5db; } .s-modern .style-swatch i:nth-child(2) { background: #111827; } .s-modern .style-swatch i:nth-child(3) { background: #4f46e5; }
@media (max-width: 560px) { .style-pick { grid-template-columns: 1fr; } }

/* =========================================================
   気持ちいい動き
   ========================================================= */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i {
  position: absolute; width: 8px; height: 11px; border-radius: 2px;
  animation: confetti .95s cubic-bezier(.15, .7, .35, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 70px)) rotate(var(--r)); opacity: 0; }
}
.check.pop { animation: pop .38s ease; }
@keyframes pop { 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.view.enter > * { animation: rise .3s ease both; }
.view.enter > *:nth-child(2) { animation-delay: .04s; }
.view.enter > *:nth-child(3) { animation-delay: .08s; }
.card, .row, .tnode, .idea { transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }

/* イラスト */
.illust-wrap { display: flex; justify-content: center; }
.illust { width: 220px; max-width: 70%; height: auto; }
.illust.small { width: 150px; }
.illust.login-art { width: 190px; margin: -6px auto 4px; }
.empty-title { font-weight: 700; font-size: 16px; }
.lane.onboarding .illust-wrap { justify-content: flex-start; }

/* =========================================================
   シフト画面
   ========================================================= */
.shift-view { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.seg.big { align-self: flex-start; padding: 4px; }
.seg.big button { padding: 7px 16px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.badge, .nav-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
.nav-item { position: relative; }
.sidebar .nav-badge { margin-left: auto; }
.bottom-nav .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10px; }
.info-bar {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-weak); color: var(--text); font-size: 13px;
}
.info-bar .ic { color: var(--accent); margin-top: 1px; }
.bulk-bar {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg);
  margin-bottom: 12px; animation: drop .15s;
}
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ok:hover { filter: brightness(1.06); background: var(--ok); }
.btn.danger-o { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--surface); }
.btn.danger-o:hover { background: var(--danger-weak); }
.btn.danger-fill { background: var(--danger); color: #fff; border-color: var(--danger); }
.btns.center { justify-content: center; margin-top: 10px; }

.day-group { margin-bottom: 16px; }
.day-group.past { opacity: .75; }
.day-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px 8px; font-size: 15px; }
.day-count { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.day-count .ic { width: 15px; height: 15px; }
.day-count b { color: var(--text); }
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border-left: 4px solid var(--border-strong); transition: box-shadow .15s, transform .15s;
}
.req-card.st-pending { border-left-color: var(--warn); }
.req-card.st-approved { border-left-color: var(--ok); }
.req-card.st-declined { border-left-color: var(--danger); opacity: .8; }
.req-card.sel { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.req-check { flex: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: hsl(var(--h, 200) 65% var(--pj-bg)); color: hsl(var(--h, 200) 55% var(--pj-fg));
}
.req-main { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.req-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req-time { display: flex; align-items: center; gap: 5px; font-size: 14px; flex-wrap: wrap; }
.req-time .ic { width: 15px; height: 15px; color: var(--muted); }
.req-note, .req-reply { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.req-reply { color: var(--accent); }
.req-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip.line { background: #06c755; color: #fff; font-weight: 700; }
.state-chip { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.state-chip.approved { background: var(--ok-weak); color: var(--ok); }
.state-chip.declined { background: var(--danger-weak); color: var(--danger); }
.state-chip.pending { background: var(--warn-weak); color: var(--warn); }
.editor-head { display: flex; align-items: center; gap: 10px; }
.field-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.field-grid input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 7px 8px; background: var(--surface); }
.form .note { min-height: 0; }

/* シフト表 */
.table-scroll { overflow: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); max-height: calc(100vh - 260px); }
.shift-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 820px; font-size: 13px; }
.shift-table th, .shift-table td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 6px; vertical-align: top; }
.shift-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 700; text-align: center; }
.shift-table thead th small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.shift-table th.sun, .shift-table th.sun small { color: var(--danger); }
.shift-table th.sat, .shift-table th.sat small { color: #3d8bfd; }
.shift-table .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 150px; }
.shift-table thead .sticky { z-index: 3; background: var(--surface-2); }
.shift-table .today { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.shift-table thead th.today { background: var(--accent); color: var(--accent-text); }
.shift-table thead th.today small { color: var(--accent-text); }
.staff-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.staff-cell .avatar { width: 28px; height: 28px; font-size: 12px; }
.shift-table td { min-width: 92px; height: 46px; }
.shift-table td.empty-cell { cursor: pointer; }
.shift-table td.empty-cell:hover { background: var(--surface-2); }
.shift-table td.empty-cell:hover::after { content: "＋"; color: var(--muted); display: block; text-align: center; }
.shift-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 700;
  background: hsl(var(--h, 200) 65% var(--pj-bg)); color: hsl(var(--h, 200) 55% var(--pj-fg)); margin: 1px 2px 1px 0; white-space: nowrap;
}
.shift-pill.pending { background: transparent; border: 1.5px dashed var(--warn); color: var(--warn); }
.shift-pill.pending small { font-size: 10px; }
.shift-pill.demo { --h: 160; }
.total-row th, .total-row td { background: var(--surface-2); text-align: center; position: sticky; bottom: 0; }
.total-row td b { display: block; font-size: 15px; }
.total-row td small { display: block; color: var(--muted); font-size: 11px; }
.total-row td small.pend { color: var(--warn); font-weight: 700; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* スタッフ */
.staff-tab { display: flex; flex-direction: column; gap: 14px; }
.staff-list { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.staff-row { display: grid; grid-template-columns: 1fr 170px 80px 44px; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.staff-row:last-child { border-bottom: 0; }
.staff-row.head { font-size: 12px; color: var(--muted); background: var(--surface-2); padding-top: 6px; padding-bottom: 6px; }
.staff-row.inactive { opacity: .55; }
.staff-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.staff-name .avatar { width: 32px; height: 32px; font-size: 13px; }

/* 今日の画面のシフト */
.shift-today h3 { display: flex; align-items: center; gap: 4px; }
.pend-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--warn); font-weight: 700; }
.pend-link .ic { width: 15px; height: 15px; }
.today-shifts { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px 6px; }
.today-shifts .shift-pill { font-weight: 500; padding: 5px 10px; }

@media (max-width: 859px) {
  .seg.big { align-self: stretch; display: flex; }
  .seg.big button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13px; }
  .req-card { flex-wrap: wrap; padding: 12px; gap: 10px; }
  .req-main { flex-basis: calc(100% - 90px); }
  .req-actions { width: 100%; justify-content: stretch; }
  .req-actions .btn { flex: 1; padding: 9px; }
  .req-actions .btn.ghost { flex: none; }
  .bulk-bar .btn { flex: 1; }
  .bulk-bar .spacer { display: none; }
  .bulk-bar b { width: 100%; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid label:first-child { grid-column: 1 / -1; }
  .table-scroll { max-height: none; margin: 0 -12px; border-radius: 0; }
  .shift-table .sticky { min-width: 104px; }
  .staff-cell .avatar { display: none; }
  .staff-row { grid-template-columns: 1fr 100px 40px; }
  .staff-row > span:nth-child(3) { display: none; }
  .bottom-nav .nav-item { font-size: 10px; }
  .bottom-nav .nav-item .ic { width: 21px; height: 21px; }
}
@media (max-width: 859px) {
  .shift-table-wrap .cal-head { flex-wrap: wrap; row-gap: 4px; }
  .shift-table-wrap .cal-title { font-size: 15px; min-width: 0; }
  .shift-table-wrap .cal-head .inline { width: 100%; }
  .info-bar { font-size: 12px; padding: 8px 12px; }
}

/* =========================================================
   プロジェクト（ツリー）：プロジェクトごとのカード・つかんで移動
   ========================================================= */
.tree { background: transparent !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; }
.tproj {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 18px;
  padding: 6px 10px 8px 8px; border-left: 4px solid hsl(var(--h, 220) 60% var(--bar-l));
}
.tkids { padding-left: 24px; }
.tnode { display: flex; align-items: center; gap: 8px; padding: 5px 6px; min-height: 40px; border-radius: 8px; margin: 0; }
.tnode.root { margin-top: 0; padding-top: 7px; padding-bottom: 7px; }
.tnode.root::before { display: none !important; }
.tnode.root .tnode-name { font-weight: 800; font-size: 15.5px; }
.tnode-title { flex: 0 1 auto; min-width: 0; text-align: left; display: inline-flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }
.tnode .check { margin-top: 0; flex: none; }
.tnode .spacer { min-width: 4px; }
.grip {
  width: 18px; height: 26px; display: grid; place-items: center; color: var(--muted); cursor: grab; flex: none;
  opacity: .3; touch-action: none; border-radius: 6px; transition: opacity .15s, background .15s;
}
.grip .ic { width: 16px; height: 16px; }
.tnode:hover .grip { opacity: .9; }
.grip:hover { background: var(--surface-2); }
.grip:active { cursor: grabbing; }
.drag-ghost { opacity: .45; }
.drag-ghost > .tnode { background: var(--accent-weak); }
.drag-chosen > .tnode { box-shadow: 0 0 0 2px var(--accent); }
.tnode.adding { padding-left: 50px; }
.tnode.adding .qi { flex: 1; }
.chip.memo { background: var(--warn-weak); color: var(--warn); }
.tree-hint { text-align: center; margin: 4px 0 20px; }
@media (hover: none) { .grip { opacity: .6; } }
@media (max-width: 859px) {
  .tkids { padding-left: 14px; }
  .tproj { padding: 4px 6px 6px 4px; }
  .tnode { gap: 6px; padding: 4px; }
  .tnode.adding { padding-left: 8px; }
}

/* =========================================================
   詳細パネル：広く表示・メモ・経過ログ
   ========================================================= */
.panel.wide { width: min(1120px, 100%); }
.panel-cols { display: flex; flex-direction: column; gap: 14px; }
.panel:not(.wide) .panel-col { display: contents; }
.panel:not(.wide) .panel-title { order: 1; }
.panel:not(.wide) .fields { order: 2; }
.panel:not(.wide) .memo-sec { order: 3; }
.panel:not(.wide) .log-sec { order: 4; }
.panel:not(.wide) .kids { order: 5; }
.panel.wide .panel-cols { display: grid; grid-template-columns: minmax(300px, .85fr) 1.35fr; gap: 28px; align-items: start; }
.panel.wide .panel-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1000px) {
  .panel.wide .panel-cols { display: flex; }
  .panel.wide .panel-col { display: contents; }
  .panel.wide .panel-title { order: 1; } .panel.wide .fields { order: 2; } .panel.wide .memo-sec { order: 3; }
  .panel.wide .log-sec { order: 4; } .panel.wide .kids { order: 5; }
}
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sec-head h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14.5px; }
.sec-head h3 .ic { width: 17px; height: 17px; color: var(--accent); }
.memo-view { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; min-height: 90px; cursor: text; }
.memo-sec .hint { margin: 6px 2px 0; }
.empty-log { margin: 10px 2px; }

/* メモの表示 */
.rich { font-size: 14.5px; line-height: 1.75; overflow-wrap: anywhere; }
.rich-p { margin: 0; }
.rich-gap { height: .55em; }
.rich-h { font-weight: 800; margin: .5em 0 .15em; line-height: 1.4; }
.rich-h1 { font-size: 17.5px; border-bottom: 2px solid var(--border); padding-bottom: 2px; }
.rich-h2 { font-size: 16px; }
.rich-h3 { font-size: 15px; color: var(--muted); }
.rich-ul { margin: .15em 0; padding-left: 1.3em; }
.rich-quote { border-left: 3px solid var(--border-strong); padding: 0 0 0 10px; color: var(--muted); margin: .2em 0; }
.rich-check { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; }
.rich-check.on > span { color: var(--muted); text-decoration: line-through; }
.check.small { width: 18px; height: 18px; margin-top: 4px; }
.check.small .ic { width: 11px; height: 11px; }
.rich-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; border-radius: 999px; background: var(--accent-weak);
  color: var(--accent); font-weight: 600; max-width: 100%; vertical-align: baseline; text-decoration: none; line-height: 1.75;
}
.rich-link:hover { filter: brightness(.95); text-decoration: underline; }
.rich-link .ic { width: 13px; height: 13px; flex: none; }
.rich-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-link small { color: var(--muted); font-weight: 400; font-size: 11px; }
.rich-img { display: block; margin: 8px 0; }
.rich-img img { max-width: 100%; max-height: 460px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; display: block; background: #fff; }
.rich-img.loading, .rich-img.missing { padding: 12px; background: var(--surface-2); border-radius: 8px; border: 1px dashed var(--border-strong); }

/* メモの入力 */
.rich-editor { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rich-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.rich-editor.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.rich-input { width: 100%; border: 0; outline: none; resize: vertical; padding: 10px 13px; background: transparent; line-height: 1.7; font-size: 14.5px; display: block; }
.rich-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 4px 6px; border-top: 1px solid var(--border); background: var(--surface-2); }
.rich-tool { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 8px; font-size: 12px; color: var(--muted); }
.rich-tool:hover { background: var(--surface); color: var(--text); }
.rich-tool .ic { width: 15px; height: 15px; }
.rich-status { margin-left: 6px; }

/* 経過ログ */
.log-sec .rich-editor { margin-bottom: 4px; }
.log-day { font-size: 12px; font-weight: 800; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 10px; }
.log-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.log-item { background: var(--surface-2); border-radius: 12px; padding: 8px 12px 10px 14px; margin-bottom: 8px; border-left: 3px solid var(--accent); }
.log-item.editing { background: transparent; padding: 0; border: 0; }
.log-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 2px; }
.log-time { font-weight: 800; color: var(--accent); }
.log-item .icon-btn { opacity: .45; }
.log-item:hover .icon-btn { opacity: 1; }

/* メモを全画面で */
.modal-backdrop.full .modal { width: min(1400px, 96vw); height: 92vh; max-height: 92vh; display: flex; flex-direction: column; }
.modal-backdrop.full .modal-body { flex: 1; min-height: 0; display: flex; padding-bottom: 16px; overflow: hidden; }
.full-note { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; flex: 1; min-height: 0; width: 100%; }
.full-pane { display: flex; flex-direction: column; min-height: 0; }
.full-label { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.rich-editor.big { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rich-input.big { flex: 1; resize: none; font-size: 15.5px; line-height: 1.85; padding: 14px 18px; }
.full-preview { flex: 1; overflow: auto; background: var(--surface-2); border-radius: 12px; padding: 14px 20px; }
.full-preview .rich { font-size: 15.5px; }
@media (max-width: 859px) {
  .full-note { grid-template-columns: 1fr; grid-template-rows: 1.2fr 1fr; }
  .modal-backdrop.full { padding: 0; }
  .modal-backdrop.full .modal { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

/* 画像を大きく見る */
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(5, 8, 15, .88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lightbox-close { position: absolute; top: 12px; right: 12px; color: #fff; }
