/* AIタスク仕分けダッシュボード スタイル */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --green-bg: #ecfdf5;
  --green-fg: #065f46;
  --green-strong: #10b981;
  --yellow-bg: #fffbeb;
  --yellow-fg: #92400e;
  --red-bg: #fef2f2;
  --red-fg: #991b1b;
  --url-bg: #eff6ff;
  --url-fg: #1e40af;
  --carryover-bg: #fff7ed;
  --carryover-border: #fdba74;
  --carryover-fg: #9a3412;
  --stale-bg: #fef2f2;
  --stale-fg: #b91c1c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── トップバー ─── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* ─── ヒーロー（今日の仕分け） ─── */
.hero {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 32px;
  margin: 32px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.hero-head, .day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.day-head {
  margin-top: 24px;
}
.hero-label, .day-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.hero-date, .day-date {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge.green  { background: var(--green-bg);  color: var(--green-fg); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow-fg); }
.badge.red    { background: var(--red-bg);    color: var(--red-fg); }
.badge.url    { background: var(--url-bg);    color: var(--url-fg); }

.hero-link {
  text-align: right;
  margin: 20px 0 0;
}
.hero-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.hero-link a:hover { text-decoration: underline; }

/* ─── md セクション ─── */
.md-section {
  margin: 28px 0;
}
.md-section h2 {
  font-size: 20px;
  margin: 0 0 14px;
  font-weight: 700;
}

/* ─── タスクリスト（チェックリスト） ─── */
.task-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--bg); }

.task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  background: var(--surface);
  transition: all 0.15s;
}
.task input[type="checkbox"]:hover {
  border-color: var(--primary);
}
.task input[type="checkbox"]:checked {
  background: var(--green-strong);
  border-color: var(--green-strong);
}
.task input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.task label {
  cursor: pointer;
  flex: 1;
  line-height: 1.6;
}
.task.is-done label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.task.is-done .time-badge {
  text-decoration: none;
  opacity: 0.6;
}

/* 時刻バッジ */
.time-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  margin-right: 8px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ─── 繰越セクション ─── */
.carryover-section {
  background: var(--carryover-bg);
  border: 1px solid var(--carryover-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
}
.carryover-section h2 {
  color: var(--carryover-fg);
  font-size: 17px;
}
.carryover-section .task-list {
  background: var(--surface);
  border: 1px solid var(--carryover-border);
}
.carryover-task {
  position: relative;
}
.date-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  margin-left: 8px;
  flex-shrink: 0;
}
.date-badge.is-stale {
  background: var(--stale-bg);
  color: var(--stale-fg);
}
.stale-warn {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--stale-bg);
  color: var(--stale-fg);
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  flex-shrink: 0;
}

/* ─── 履歴セクション ─── */
.history {
  margin: 40px 0;
}
.history h2 {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.history-item + .history-item {
  border-top: 1px solid var(--border);
}
.history-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.history-link:hover { background: var(--bg); }
.history-date {
  font-weight: 700;
  min-width: 110px;
}
.history-title {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}
.history-badges {
  display: flex;
  gap: 6px;
}
.mini {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.mini.green  { background: var(--green-bg);  color: var(--green-fg); }
.mini.yellow { background: var(--yellow-bg); color: var(--yellow-fg); }
.mini.red    { background: var(--red-bg);    color: var(--red-fg); }
.mini.url    { background: var(--url-bg);    color: var(--url-fg); }

/* ─── 詳細ページ用 ─── */
.back {
  margin: 24px 0;
}
.back a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}
.back a:hover { text-decoration: underline; }

main.container h3 { font-size: 16px; margin: 24px 0 8px; color: var(--muted); }
main.container p { margin: 12px 0; }
main.container a {
  color: var(--primary);
  text-decoration: none;
}
main.container a:hover { text-decoration: underline; }

main.container ul:not(.task-list):not(.history-list) {
  padding-left: 22px;
  margin: 12px 0;
}
main.container ul:not(.task-list):not(.history-list) li { margin: 4px 0; }

main.container blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  background: var(--bg);
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  color: var(--muted);
}

main.container code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

main.container hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* テーブル */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-wrap th,
.table-wrap td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.table-wrap th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.table-wrap tr:last-child td { border-bottom: 0; }

/* セクションごとの見出しカラー */
.md-section h2:first-child { padding-top: 0; }

/* ─── フッター ─── */
.footer {
  margin-top: 60px;
  padding: 20px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ─── レスポンシブ ─── */
@media (max-width: 600px) {
  .hero { padding: 20px; }
  .hero-date, .day-date { font-size: 22px; }
  .history-link { flex-wrap: wrap; }
  .history-date { min-width: 0; }
  .history-title { flex-basis: 100%; }
  .task { flex-wrap: wrap; }
  .date-badge { margin-left: 32px; margin-top: 4px; }
}
