* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: #f4f6f9;
  color: #333;
}
/* ---- ヘッダー（ToriNote） ---- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 200px;
  padding: 0 24px 0 32px;
  overflow: hidden;
  background: linear-gradient(120deg, #fbf8f4 0%, #f3ebe3 60%, #ece6f0 100%);
  border-bottom: 3px solid #e8835f;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 2.2rem; letter-spacing: .02em; color: #3a3530; }
.brand-icon { width: 56px; height: 56px; box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0,0,0,.15); }
.hero-sub { margin: 4px 0 0; font-weight: bold; color: #e8835f; }
.hero-copy { margin: 8px 0 0; font-size: .9rem; color: #6b625a; line-height: 1.6; }
.hero-illust {
  height: 240px;
  align-self: flex-start;
  margin-top: -8px;
  mix-blend-mode: multiply; /* イラストの白い背景をヘッダーになじませる */
}

/* イラストから顔の部分だけを丸く切り抜いたアイコン */
.tori-face {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  background: #fff url(torinote.webp) no-repeat 45% 1% / 380%;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 24px;
}
.stat {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.stat .label { display: block; font-size: .9rem; color: #666; }
.stat .num { display: block; font-size: 2rem; font-weight: bold; color: #3b5bdb; }
.stat.alert .num { color: #e8590c; }
.stat.done .num { color: #2b8a3e; }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 24px 24px;
}
@media (max-width: 760px) {
  main, .dashboard { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; }
  .dashboard { grid-template-columns: 1fr 1fr; gap: 10px; }
  .board-section, .secretary, .done-section { margin-left: 16px; margin-right: 16px; }
  .hero { height: 150px; padding: 0 8px 0 16px; }
  .hero-illust { height: 170px; }
  .hero-copy { display: none; }
  .brand h1 { font-size: 1.6rem; }
  .brand-icon { width: 40px; height: 40px; }
  .secretary { gap: 10px; }
  .sec-avatar .tori-face { width: 48px; height: 48px; }
  .sec-main { font-size: 1rem; }
  .sec-footer { flex-direction: column; align-items: flex-start; }
  .board-head { flex-direction: column; }
}
.panel {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.panel h2 { font-size: 1.1rem; border-bottom: 2px solid #e9ecef; padding-bottom: 6px; }

form { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: #555; }
input, textarea, select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
}
button {
  font: inherit;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #3b5bdb;
  color: #fff;
  cursor: pointer;
}
button:hover { opacity: .85; }
button.small { padding: 4px 10px; font-size: .85rem; }
button.danger { background: #e03131; }
button.secondary { background: #868e96; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.list .empty { color: #aaa; border: none; text-align: center; }
.memo-title { font-weight: bold; }
.memo-body { white-space: pre-wrap; margin: 6px 0; }
.meta { font-size: .8rem; color: #888; }
.memo-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
button { white-space: nowrap; }

.task { display: flex; align-items: flex-start; gap: 10px; }
.task > input[type="checkbox"] { margin-top: 4px; }
.task .content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.task .actions { justify-content: flex-end; }
.task.done .text { text-decoration: line-through; color: #aaa; }
.badge.step-badge { background: #3b5bdb; color: #fff; margin-left: 0; }

/* 前提タスクのチェックボックス一覧 */
.deps {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 6px 10px;
  color: #333;
}
.deps label { display: block; padding: 2px 0; cursor: pointer; }
.deps.empty-deps { color: #aaa; }
.badge {
  display: inline-block;
  font-size: .75rem;
  padding: 1px 8px;
  border-radius: 10px;
  margin: 0 4px;
}
.badge.todo { background: #fff4e6; color: #e8590c; }
.badge.done { background: #ebfbee; color: #2b8a3e; }
.badge.late { background: #fff5f5; color: #c92a2a; }
.badge.prio-high { background: #ffe3e3; color: #c92a2a; }
.badge.prio-medium { background: #fff9db; color: #e67700; }
.badge.prio-low { background: #e7f5ff; color: #1971c2; }
.due.overdue { color: #e03131; font-weight: bold; }
.due.today { color: #e8590c; font-weight: bold; }

/* メモとタスクの連動 */
.link-tag {
  display: inline-block;
  font-size: .75rem;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  border-radius: 10px;
  background: #edf2ff;
  color: #3b5bdb;
}
.link-tag.plain { background: #f1f3f5; color: #868e96; }
.link-tag.wait { background: #fff4e6; color: #d9480f; }
.linked-memos { font-size: .8rem; color: #555; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff3bf; } to { background: transparent; } }

/* ---- タスク進行ボード ---- */
.board-section {
  margin: 0 24px 16px;
  background: #fff;
  border-radius: 10px;
  padding: 12px 20px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.board-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.board-head h2 { font-size: 1.1rem; margin: 4px 0; }
.board-head button { flex: none; }
.hint { font-size: .8rem; color: #666; margin: 0 0 10px; line-height: 1.6; }
.legend { padding: 0 6px; border-radius: 4px; }
.legend.pre { background: #d3f9d8; color: #2b8a3e; }
.legend.post { background: #e5dbff; color: #6741d9; }

.board {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  padding: 4px 0 8px;
  min-height: 120px;
}
.board > .empty { color: #aaa; margin: auto; }

.step {
  flex: none;
  width: 210px;
  background: #f1f3f5;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, background .15s;
}
.step.first { background: #edf2ff; }
.step.over { border-color: #3b5bdb; background: #dbe4ff; }
.step-head { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .8rem; margin-bottom: 6px; }
.step-no { font-weight: bold; color: #3b5bdb; }
.now { background: #3b5bdb; color: #fff; border-radius: 10px; padding: 0 8px; }
.parallel { color: #6741d9; }
.cards { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 40px; }

.card {
  background: #fff;
  border-radius: 8px;
  border-left: 5px solid #fab005;
  padding: 6px 8px;
  font-size: .85rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  cursor: grab;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.card.prio-high { border-left-color: #fa5252; }
.card.prio-low { border-left-color: #4dabf7; }
.card.drag-src { opacity: .35; }
.card.rel-pre { box-shadow: 0 0 0 3px #69db7c; }
.card.rel-post { box-shadow: 0 0 0 3px #9775fa; }
.card-title { font-weight: bold; word-break: break-word; }
.card-meta { margin: 3px 0; font-size: .75rem; color: #666; }
.card-meta .badge { margin-left: 0; }
.card-state { font-size: .75rem; }
.card-state.ready { color: #2b8a3e; }
.card-state.wait { color: #d9480f; }
.card-warn { font-size: .72rem; color: #c92a2a; background: #fff5f5; border-radius: 4px; padding: 2px 4px; margin-top: 3px; }

/* ステップ間の矢印 兼 ドロップ先（新しいステップ） */
.gap {
  flex: none;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  border-radius: 8px;
  transition: width .15s, background .15s;
}
.gap.edge .arrow { visibility: hidden; }
.gap .drop-label { display: none; font-size: .7rem; text-align: center; color: #3b5bdb; }
.board.is-dragging .gap { width: 64px; border: 2px dashed #bac8ff; margin: 0 2px; }
.board.is-dragging .gap .arrow { display: none; }
.board.is-dragging .gap .drop-label { display: block; }
.gap.over { background: #dbe4ff; border-color: #3b5bdb !important; }
.drop-marker { height: 4px; border-radius: 2px; background: #3b5bdb; }

/* ---- 秘書からのひとこと ---- */
.secretary {
  margin: 0 24px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.sec-avatar {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sec-avatar .tori-face {
  width: 72px;
  height: 72px;
  box-shadow: 0 0 0 3px #e8835f, 0 2px 6px rgba(0,0,0,.15);
}
.sec-name { font-size: .75rem; font-weight: bold; color: #e8835f; }
.sec-bubble {
  position: relative;
  flex: 1;
  background: #fff;
  border: 2px solid #3b5bdb;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.sec-bubble::before {  /* 吹き出しのしっぽ */
  content: "";
  position: absolute;
  left: -10px;
  top: 28px;
  border: 8px solid transparent;
  border-right-color: #3b5bdb;
  border-left: 0;
}
.sec-greeting { font-size: .85rem; color: #666; }
.sec-main { font-size: 1.15rem; margin: 4px 0; }
.sec-task { color: #3b5bdb; }
.sec-detail { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .85rem; color: #555; }
.sec-detail .badge { margin: 0; }
.sec-line { font-size: .9rem; margin-top: 4px; }
.sec-alert { color: #c92a2a; }
.sec-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }

/* ---- 完了したタスク（振り返り） ---- */
.done-section {
  margin: 0 24px 24px;
  background: #fff;
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.done-head { display: flex; justify-content: space-between; align-items: center; }
.done-head h2 { font-size: 1.1rem; margin: 4px 0; color: #2b8a3e; }
.done-count { font-size: .85rem; color: #888; font-weight: normal; margin-left: 6px; }
.done-section:not(.collapsed) .done-head { border-bottom: 2px solid #e9ecef; padding-bottom: 6px; margin-bottom: 8px; }
.done-section > #doneBody > .empty { color: #aaa; text-align: center; }
.done-day { font-size: .9rem; color: #555; margin: 14px 0 6px; }
.done-day span { font-weight: normal; color: #888; margin-left: 8px; font-size: .8rem; }
.task.done-item { background: #f8f9fa; }
.task.done-item .text { color: #555; }
