:root {
  --paper: oklch(0.982 0.003 90);
  --paper-raised: oklch(0.997 0.002 90);
  --paper-sunken: oklch(0.962 0.004 90);
  --ink: oklch(0.25 0.008 80);
  --ink-soft: oklch(0.46 0.01 80);
  --ink-faint: oklch(0.64 0.008 82);
  --rule: oklch(0.905 0.005 85);
  --rule-strong: oklch(0.82 0.007 84);
  --shu: oklch(0.56 0.16 32);
  --shu-soft: oklch(0.945 0.025 40);
  --matsu: oklch(0.48 0.06 155);
  --matsu-soft: oklch(0.945 0.022 155);
  --kon: oklch(0.42 0.07 260);
  --kon-soft: oklch(0.945 0.022 260);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;

  --font-body: "Zen Kaku Gothic New", "Yu Gothic", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  height: 100vh;
  display: grid;
  grid-template-columns: 200px 1fr;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.65;
}

/* ============ サイドバー ============ */
aside:not(.drawer) {
  background: var(--paper-sunken);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  padding: var(--space-md) 0;
  overflow-y: auto;
}

.brand {
  padding: 0 var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand h1 { font-size: 15px; font-weight: 700; letter-spacing: 0.04em; }
.brand .stamp {
  width: 18px; height: 18px;
  background: var(--shu);
  color: var(--paper-raised);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.brand small { color: var(--ink-faint); font-size: 10px; letter-spacing: 0.1em; }

.search { padding: 0 var(--space-md); margin-bottom: var(--space-md); }
.search input {
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 4px 8px;
  outline: none;
}
.search input:focus { border-color: var(--rule-strong); }
.search input::placeholder { color: var(--ink-faint); }

nav { display: flex; flex-direction: column; gap: 1px; padding: 0 var(--space-sm); }

.nav-label {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  padding: 0 var(--space-sm);
  margin: 0 0 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px var(--space-sm);
  border-radius: 5px;
  color: var(--ink-soft);
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  width: 100%;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: oklch(0.93 0.005 88); color: var(--ink); }
.nav-item.active {
  background: var(--paper-raised);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 2px oklch(0.3 0.01 80 / 0.05);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--shu); font-weight: 700; }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.sidebar-foot {
  margin-top: auto;
  padding: var(--space-md) var(--space-md) 0;
  font-size: 11px;
  color: var(--ink-faint);
}
.sidebar-foot .ratio {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--shu);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============ メイン ============ */
main {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) clamp(16px, 3vw, 36px) var(--space-xl);
}

.day-header {
  margin-bottom: var(--space-md);
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}
.day-header .kanji-date { font-size: 17px; font-weight: 700; line-height: 1.4; }
.day-header .kanji-date em { font-style: normal; }
.day-header .sub {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  color: var(--ink-faint);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

/* ============ ボード ============ */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  align-items: start;
  padding-bottom: var(--space-lg);
  flex: none;
}

.column { display: flex; flex-direction: column; min-width: 0; }

.column-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-bottom: 5px;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--rule-strong);
}
.column-head h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-soft); }
.column-head .n { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.column-head .archive-btn {
  margin-left: auto;
  border: none;
  background: none;
  font: inherit;
  font-size: 10.5px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
}
.column-head .archive-btn:hover { color: var(--shu); background: var(--paper-sunken); }

.column-body {
  min-height: 40px;
  border-radius: 6px;
  transition: box-shadow 0.15s ease;
}
.column-body.drag-over { box-shadow: inset 0 0 0 2px oklch(0.6 0.1 32 / 0.3); }

.col-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
}
.col-add .plus { font-size: 14px; color: var(--ink-faint); transition: color 0.12s ease; }
.col-add:focus-within .plus { color: var(--shu); }
.col-add input {
  flex: 1;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.col-add input::placeholder { color: var(--ink-faint); }

/* カード */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 8px;
  margin-bottom: 6px;
  cursor: grab;
  transition: border-color 0.12s ease, opacity 0.2s ease;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.card:hover { border-color: var(--rule-strong); }
.card.dragging { opacity: 0.35; cursor: grabbing; }
.card-main { flex: 1; min-width: 0; }

.check {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 50%;
  margin-top: 3px;
  cursor: pointer;
  flex: none;
  position: relative;
  background: var(--paper-raised);
  transition: border-color 0.12s ease, background 0.15s ease;
}
.check:hover { border-color: var(--shu); }
.check:checked { background: var(--shu); border-color: var(--shu); }
.check:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 9px no-repeat
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path d="M2 6.5 5 9.5 10 3" fill="none" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
.check:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }

.card-title { font-size: 12.5px; font-weight: 500; line-height: 1.5; }
.card.is-done .card-title {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: oklch(0.72 0.01 80);
}
.card.is-done { background: var(--paper); }

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.card-meta:empty { display: none; }

/* カード上のサブタスク */
.card-subs {
  margin-top: 4px;
  border-top: 1px dashed var(--rule);
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-sub {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  cursor: default;
}
.card-sub input {
  appearance: none;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 3px;
  margin-top: 4px;
  cursor: pointer;
  flex: none;
  position: relative;
  background: var(--paper-raised);
}
.card-sub input:hover { border-color: var(--shu); }
.card-sub input:checked { background: var(--shu); border-color: var(--shu); }
.card-sub input:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 7px no-repeat
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path d="M2 6.5 5 9.5 10 3" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}
.card-sub.done span { color: var(--ink-faint); text-decoration: line-through; }

.tag {
  padding: 0 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
}
.tag.work { background: var(--shu-soft); color: var(--shu); }
.tag.home { background: var(--matsu-soft); color: var(--matsu); }
.tag.study { background: var(--kon-soft); color: var(--kon); }

.due { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.due.overdue { color: var(--shu); font-weight: 700; }

.fuda {
  font-size: 10px;
  font-weight: 700;
  color: var(--shu);
  border: 1px solid oklch(0.84 0.06 35);
  border-radius: 3px;
  padding: 0 3px;
}
.recur-mark { letter-spacing: 0.02em; }

.task.done .tag { opacity: 0.55; }

/* カード上の移動ボタン */
.card-nav {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.card:hover .card-nav, .card:focus-within .card-nav { opacity: 1; }
.card-nav button {
  border: none;
  background: var(--paper-sunken);
  color: var(--ink-soft);
  border-radius: 3px;
  width: 18px; height: 18px;
  font-size: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card-nav button:hover { background: var(--rule); color: var(--ink); }
.card-nav button:disabled { opacity: 0.3; cursor: default; }

.column-empty {
  color: var(--ink-faint);
  font-size: 11.5px;
  padding: var(--space-sm) 2px;
}

/* ============ 週間 ============ */
.week { flex: none; }
.week-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: 6px;
}
.week-range {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.week-nav {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink-soft);
  border-radius: 5px;
  width: 22px; height: 22px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.week-nav:hover { background: var(--paper-sunken); color: var(--ink); }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule);
}
.day {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  min-height: 86px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  background: var(--paper-raised);
}
.day.is-today { background: oklch(0.975 0.01 90); }
.day.drag-over { box-shadow: inset 0 0 0 2px oklch(0.6 0.1 32 / 0.3); }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.day-head .wd { font-weight: 700; }
.day.sat .wd { color: var(--kon); }
.day.sun .wd { color: var(--shu); }
.day.is-today .day-head::after {
  content: "今日";
  font-size: 9px;
  color: var(--shu);
  border: 1px solid oklch(0.84 0.06 35);
  border-radius: 3px;
  padding: 0 3px;
  margin-left: auto;
}

.chip {
  font-size: 10.5px;
  line-height: 1.45;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--paper-sunken);
  border: 1px solid oklch(0.3 0.01 80 / 0.04);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  transition: background 0.12s ease;
  text-align: left;
  color: var(--ink);
  font-family: inherit;
}
.chip:hover { background: var(--rule); }
.chip .dot { width: 5px; height: 5px; margin-top: 5px; }
.chip.chip-done { color: var(--ink-faint); text-decoration: line-through; }
.chip span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.day-add {
  margin-top: auto;
  border: none;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: 10.5px;
  text-align: left;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 3px;
  opacity: 0.55;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.day:hover .day-add { opacity: 1; }
.day-add:hover { background: var(--paper-sunken); color: var(--ink-soft); }
.day-add-input {
  border: none;
  border-bottom: 1px solid var(--shu);
  background: none;
  font: inherit;
  font-size: 10.5px;
  color: var(--ink);
  outline: none;
  width: 100%;
  margin-top: auto;
}

/* ============ ボタン ============ */
.ghost-btn {
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  border-radius: 5px;
  padding: 4px 12px;
  cursor: pointer;
  flex: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.ghost-btn:hover { background: var(--paper-sunken); color: var(--ink); }

.primary-btn {
  border: none;
  background: var(--shu);
  color: oklch(0.99 0.005 40);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  padding: 5px 16px;
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.primary-btn:hover { opacity: 0.88; }

.header-actions { display: flex; gap: var(--space-sm); flex: none; }

/* 同期チップ */
.sync-chip {
  margin-top: var(--space-sm);
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink-soft);
  font: inherit;
  font-size: 11px;
  border-radius: 5px;
  padding: 3px 7px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sync-chip:hover { background: var(--paper-sunken); color: var(--ink); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); flex: none; }
.sync-dot.synced { background: var(--matsu); }
.sync-dot.syncing { background: oklch(0.7 0.13 80); }
.sync-dot.error { background: var(--shu); }

.modal-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.7; margin-bottom: var(--space-sm); }
.auth-form { display: flex; flex-direction: column; gap: var(--space-sm); }
.auth-form label {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--ink-faint);
}
.auth-form input {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 5px; padding: 6px 8px; outline: none;
}
.auth-form input:focus { border-color: var(--shu); }
.auth-error {
  font-size: 12px; color: var(--shu);
  background: var(--shu-soft); border-radius: 5px; padding: 6px 8px;
}
.sync-state { font-size: 12px; color: var(--ink-faint); margin-bottom: var(--space-md); }

/* プラン表示 */
.plan-box {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: var(--space-md);
  background: var(--paper);
}
.plan-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.plan-name { font-size: 13px; font-weight: 700; }
.plan-name.pro { color: var(--shu); }
.plan-note { font-size: 11px; color: var(--ink-faint); margin-left: auto; }
.price-row { display: flex; gap: var(--space-sm); align-items: center; }
.plan-box .modal-desc { margin-bottom: var(--space-sm); }
.plan-box .modal-hint { display: block; margin-top: 6px; }

/* 有料機能のロック表示 */
.locked {
  opacity: 0.45;
  pointer-events: none;
}
.lock-note {
  font-size: 11.5px;
  color: var(--ink-faint);
  background: var(--paper-sunken);
  border-radius: 5px;
  padding: 6px 9px;
  margin-bottom: var(--space-sm);
}

.help-list {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.75;
  margin: 0 0 var(--space-sm);
  padding-left: 18px;
}
.help-list li { margin-bottom: 3px; }
.help-list code {
  font-size: 11px;
  background: var(--paper-sunken);
  border-radius: 3px;
  padding: 0 3px;
}
.modal-desc a { color: var(--shu); }

/* 週カレンダー上のGoogle予定 */
.chip.gcal {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-style: normal;
}
.chip.gcal:hover { background: var(--paper-sunken); }
.chip.gcal .bar {
  width: 2px;
  align-self: stretch;
  border-radius: 1px;
  flex: none;
  min-height: 12px;
}

.url-row { display: flex; gap: 6px; }
.url-row input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 11.5px; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 5px; padding: 5px 8px; outline: none;
}

/* ============ モーダル ============ */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: oklch(0.3 0.01 80 / 0.28);
  z-index: 60;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.modal-scrim.open { opacity: 1; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(460px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 16px 48px oklch(0.3 0.01 80 / 0.2);
  z-index: 70;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transform: translate(-50%, -48%) scale(0.98);
  opacity: 0;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}
.modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }

.modal-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-xs);
}
.modal-hint { margin-right: auto; font-size: 11px; color: var(--ink-faint); }

#a-memo {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 9px;
  resize: vertical;
  outline: none;
}
#a-memo:focus { border-color: var(--shu); }

/* ============ ドロワー共通 ============ */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: oklch(0.3 0.01 80 / 0.22);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer-scrim.open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 92vw);
  background: var(--paper-raised);
  border-left: 1px solid var(--rule);
  box-shadow: -6px 0 24px oklch(0.3 0.01 80 / 0.1);
  z-index: 50;
  padding: var(--space-md) var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-label { font-size: 11.5px; letter-spacing: 0.16em; color: var(--ink-faint); font-weight: 700; }
.icon-btn {
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: 13px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
}
.icon-btn:hover { background: var(--paper-sunken); color: var(--ink); }

.d-title {
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  background: none;
  padding: 2px 0 6px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.d-title:focus { border-bottom-color: var(--shu); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-md);
}
.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}
.field-grid select, .field-grid input {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 4px 7px;
  outline: none;
}
.field-grid select:focus, .field-grid input:focus { border-color: var(--shu); }

.check-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.check-line input { accent-color: var(--shu); width: 14px; height: 14px; }

.d-section { display: flex; flex-direction: column; gap: 3px; }
.d-section-head {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  margin-bottom: 3px;
}

.subtask { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.subtask input[type="checkbox"] { accent-color: var(--shu); width: 14px; height: 14px; flex: none; }
.subtask span { flex: 1; font-size: 12.5px; }
.subtask.done span { color: var(--ink-faint); text-decoration: line-through; }
.subtask .rm {
  border: none; background: none; color: var(--ink-faint);
  cursor: pointer; font-size: 11px; padding: 1px 5px; border-radius: 3px;
  opacity: 0;
}
.subtask:hover .rm { opacity: 1; }
.subtask .rm:hover { background: var(--paper-sunken); color: var(--shu); }

.sub-add { display: flex; align-items: center; gap: 7px; padding-top: 1px; }
.sub-add .plus { font-size: 14px; color: var(--shu); }
.sub-add input {
  flex: 1; border: none; background: none; font: inherit; font-size: 12.5px;
  color: var(--ink); outline: none; border-bottom: 1px solid var(--rule);
  padding: 1px 0;
}
.sub-add input:focus { border-bottom-color: var(--shu); }
.sub-add input::placeholder { color: var(--ink-faint); }

#d-memo {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 9px;
  resize: vertical;
  outline: none;
}
#d-memo:focus { border-color: var(--shu); }

.danger-btn {
  margin-top: auto;
  border: 1px solid oklch(0.84 0.06 35);
  background: none;
  color: var(--shu);
  font: inherit;
  font-size: 12px;
  border-radius: 5px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.danger-btn:hover { background: var(--shu-soft); }

/* 日報ドロワー */
.drawer.report { width: min(480px, 95vw); }
.report-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}
.report-date input {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 3px 7px;
  outline: none;
}
.report-date input:focus { border-color: var(--shu); }
#report-text {
  flex: 1;
  min-height: 220px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 8px 10px;
  resize: none;
  outline: none;
  white-space: pre-wrap;
}
#report-text:focus { border-color: var(--shu); }
.report-actions { display: flex; gap: var(--space-sm); }
.drawer.report details summary {
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.drawer.report .hint { font-size: 11px; color: var(--ink-faint); margin: 5px 0; }
#report-template {
  width: 100%;
  font: inherit;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 9px;
  resize: vertical;
  outline: none;
}
#report-template:focus { border-color: var(--shu); }

/* スクロールバー */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 5px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* モバイル用の上部バー(サイドバーの代わり) */
.mobile-bar { display: none; }
.m-tags { display: none; }

/* 狭い幅 */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  aside:not(.drawer) { display: none; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px var(--space-md);
    background: var(--paper-sunken);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .mobile-bar .stamp {
    width: 22px; height: 22px;
    background: var(--shu);
    color: var(--paper-raised);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: none;
  }
  .mobile-bar input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    background: var(--paper-raised);
    border: 1px solid var(--rule);
    border-radius: 5px;
    padding: 5px 9px;
    outline: none;
  }
  .mobile-bar input:focus { border-color: var(--shu); }
  .mobile-bar .sync-chip { margin-top: 0; width: auto; flex: none; }

  .m-tags {
    display: flex;
    flex: none;
    gap: 5px;
    overflow-x: auto;
    padding: 0 0 var(--space-sm);
    scrollbar-width: none;
  }
  .m-tags button { flex: none; }
  .m-tags::-webkit-scrollbar { display: none; }
  .m-tags button {
    border: 1px solid var(--rule);
    background: var(--paper-raised);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    border-radius: 99px;
    padding: 3px 12px;
    cursor: pointer;
    flex: none;
  }
  .m-tags button.active {
    background: var(--ink);
    color: var(--paper-raised);
    border-color: var(--ink);
    font-weight: 700;
  }

  main { padding: var(--space-md) var(--space-md) var(--space-xl); }
  .day-header { flex-wrap: wrap; gap: var(--space-sm); }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1; padding-top: 8px; padding-bottom: 8px; }

  .board { grid-template-columns: 1fr; }
  .week { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .week-grid { min-width: 660px; }

  /* 指で押しやすく */
  .check { width: 20px; height: 20px; }
  .card-sub input { width: 14px; height: 14px; margin-top: 3px; }
  .card { padding: 9px 10px; }
  .card-nav { opacity: 1; }
  .card-nav button { width: 26px; height: 26px; font-size: 11px; }
  .modal { padding: var(--space-md); }
  .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .mobile-bar input { font-size: 12px; }
}
