/*
 * 卓準備カレンダー（紙の手帳テーマ）
 * 色・文字・ボタンは shared/hub/hub.css の変数と部品を使う。ここではカレンダー固有の配置だけを書く。
 */

/* ---------- 配置 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.calendar-area { grid-row: span 2; min-width: 0; }
.side-column { display: grid; gap: 18px; align-content: start; min-width: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar-spacer { flex: 1; }
.file-label { position: relative; }

/* ---------- 紙のパネル ---------- */
.focus-panel,
.month-card,
.panel,
.detail-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.focus-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 18px;
  border-color: var(--note-line);
  background: var(--note);
}
.focus-panel strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: 19px; }
.focus-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- 月表示 ---------- */
.month-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.month-head h2 { font-size: 21px; letter-spacing: 0.04em; min-width: 7.5em; text-align: center; }
.month-head #todayBtn { margin-left: auto; }
.month-nav {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--sheet-sub);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.month-nav:hover { color: var(--ink); }

.weekdays,
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }

.weekdays span {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--sheet-sub);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.weekdays span:first-child { color: var(--pen-red); }
.weekdays span:last-child { color: var(--pen-blue); }

.day {
  display: block;
  position: relative;
  min-height: 118px;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: var(--sheet-sub); }
.day.other { opacity: 0.4; }
.day.today .day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--pen-red);
  color: var(--sheet) !important;
}
.day.selected { background: var(--note); box-shadow: inset 0 0 0 2px var(--note-line); }
.day-num { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.day-add { float: right; color: var(--faint); opacity: 0; }
.day:hover .day-add,
.day.selected .day-add { opacity: 1; }
.day:nth-child(7n+1) .day-num { color: var(--pen-red); }
.day:nth-child(7n) .day-num { color: var(--pen-blue); }

.event {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 7px;
  border-left: 3px solid var(--pen-blue);
  border-radius: 6px;
  background: var(--sys-coc6-bg);
  color: var(--sys-coc6-ink);
  font-size: 11.5px;
  line-height: 1.4;
}
.event.voice { border-left-color: var(--sys-emo-ink); background: var(--sys-emo-bg); color: var(--sys-emo-ink); }
.event-time { display: block; opacity: 0.8; }
.event-title { display: block; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 右側：今日・タスク・詳細 ---------- */
.panel h2,
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel h2,
.detail-head h2 { font-size: 17px; letter-spacing: 0.04em; }
#weekRange { color: var(--muted); font-family: var(--font-body); font-size: 12px; font-weight: 700; }
.detail-head button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--sheet-sub);
  color: var(--muted);
  cursor: pointer;
}
.panel-note { margin: 10px 18px 0; color: var(--muted); font-size: 12px; }
.stack-list,
.task-list { display: grid; gap: 8px; padding: 12px 14px; }

.mini-card,
.task-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--sheet);
  color: var(--ink);
}
p.mini-card { margin: 0; color: var(--muted); border-style: dashed; }
.mini-card { width: 100%; text-align: left; cursor: pointer; }
button.mini-card:hover { border-color: var(--ink-soft); }
.mini-card strong { display: block; font-size: 15px; }
.mini-card small,
.task-main small { color: var(--muted); }

.task-card {
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  gap: 8px;
  align-items: center;
}
.task-card.dragging { opacity: 0.45; }
.task-card.done strong { color: var(--faint); text-decoration: line-through; }
.task-check { display: grid; place-items: center; cursor: pointer; }
.task-check input { position: absolute; opacity: 0; pointer-events: none; }
.task-check span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 6px;
  background: var(--sheet);
}
.task-check input:focus-visible + span { outline: 2px solid var(--pen-blue); outline-offset: 2px; }
.task-check input:checked + span { border-color: var(--pen-blue); background: var(--pen-blue); }
.task-check input:checked + span::after { content: '✓'; color: var(--sheet); font-size: 15px; font-weight: 700; }
.task-main { display: grid; gap: 2px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.drag-grip { color: var(--faint); cursor: grab; }

.chip {
  display: inline-flex;
  width: fit-content;
  margin: 6px 4px 0 0;
  padding: 2px 8px;
  border: 1px solid var(--sys-other-line);
  border-radius: 999px;
  background: var(--sys-other-bg);
  color: var(--sys-other-ink);
  font-size: 11px;
  font-weight: 700;
}
.chip.green { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-ink); }
.chip.red { border-color: rgba(181, 82, 58, 0.35); background: rgba(181, 82, 58, 0.08); color: var(--pen-red); }
.chip.amber { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.wide-button { width: calc(100% - 28px); margin: 0 14px 14px; }

.detail-content { padding: 16px 18px; }
.detail-content.empty { color: var(--muted); }
.detail-title { margin: 0 0 10px; font-size: 22px; }
.detail-content h4 { margin: 16px 0 6px; color: var(--faint); font-size: 11px; letter-spacing: 0.12em; }
.detail-content p { margin: 6px 0; color: var(--ink-soft); }
.detail-row { display: grid; grid-template-columns: 88px 1fr; gap: 10px; margin: 6px 0; color: var(--muted); font-size: 13px; }
.detail-row b { color: var(--ink); font-weight: 500; }
.people,
.links,
.detail-tasks { display: grid; gap: 6px; }
.person,
.link-pill,
.task-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 6px 12px;
  background: var(--sheet-sub);
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}
.hub .link-pill { color: var(--ink-soft); }
.link-pill span { color: var(--pen-blue); font-weight: 700; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.bridge-button { grid-column: 1 / -1; }
.hub-btn.danger { border-color: rgba(181, 82, 58, 0.35); color: var(--pen-red); }

/* ---------- ダイアログ ---------- */
.modal {
  width: min(860px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 0;
}
.modal::backdrop { background: rgba(46, 41, 34, 0.35); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, var(--ruled) 27px 28px);
  box-shadow: inset 3px 0 0 rgba(181, 82, 58, 0.45);
}
.modal-head h2 { margin: 0; font-size: 19px; }
.modal button {
  min-height: 34px;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
}
.modal button.primary { border-color: var(--ink); background: var(--ink); color: var(--sheet); }
.modal button.danger { border-color: rgba(181, 82, 58, 0.35); color: var(--pen-red); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; padding: 16px 20px; }
.form-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.full { grid-column: 1 / -1; }
.modal input,
.modal textarea,
.modal select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 14px;
}
.modal textarea { min-height: 70px; resize: vertical; }
.modal-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.import-body { padding: 16px 20px; }
.import-body p { margin-top: 0; color: var(--muted); }
.source-list { display: grid; gap: 8px; }
.source-option { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--sheet-sub); }
.source-option small { display: block; color: var(--muted); }
.source-option input { accent-color: var(--pen-blue); }

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: 0.2s;
  border-radius: 999px;
  background: var(--ink);
  color: var(--sheet);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .calendar-area { grid-row: auto; }
}

@media (max-width: 760px) {
  .focus-panel { flex-direction: column; align-items: stretch; }
  .toolbar { gap: 6px; }
  .toolbar-spacer { flex-basis: 100%; height: 0; }
  .day { min-height: 82px; padding: 5px; }
  .event { padding: 2px 4px; font-size: 10.5px; }
  .event-time { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .toast { bottom: 84px; }
}
