/* イマここ Todo 公開版 UI v1 — PC-primary, plain CSS. */
:root {
  --ink: #23272e;
  --muted: #6b7280;
  --line: #d9dde3;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --organize-bg: #eef4fb;
  --execute-bg: #eefaf0;
  --panel: #ffffff;
  --chip: #eef0f3;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink);
  background: #f4f6f2;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
}
button:hover { background: #f3f4f6; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: #1d4ed8; }
button.danger { color: var(--danger); border-color: #f3c2c2; }
button.subtle { border-color: transparent; background: transparent; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
}
textarea { width: 100%; }
a { color: var(--accent); }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- header / mode switch ---------- */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: inherit;
}
header.topbar .brand { display: flex; flex-direction: column; line-height: 1.15; }
header.topbar .brand small { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
header.topbar .brand h1 { font-size: 18px; margin: 0; }
.switcher { display: flex; gap: 4px; background: rgba(255,255,255,.6); padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.switcher button { border: none; border-radius: 999px; padding: 5px 16px; background: transparent; font-weight: 600; }
.switcher button.selected { background: var(--accent); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .userbox { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.topbar .userbox .name { color: var(--ink); font-weight: 600; }
body.mode-organizer { background: var(--organize-bg); }
body.mode-execution { background: var(--execute-bg); }

/* ---------- auth ---------- */
.auth-wrap { max-width: 420px; margin: 8vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.auth-wrap h1 { margin: 0 0 4px; font-size: 22px; }
.auth-wrap .sub { color: var(--muted); margin: 0 0 20px; }
.auth-wrap form { display: grid; gap: 12px; }
.auth-wrap label { display: grid; gap: 4px; font-weight: 600; }
.auth-wrap .links { margin-top: 16px; display: flex; gap: 14px; flex-wrap: wrap; }
.notice { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 10px 12px; }
.error { color: var(--danger); }
.ok-msg { color: var(--ok); }

/* ---------- organizer layout ---------- */
.layout { display: flex; min-height: calc(100vh - 57px); }
aside.sidebar {
  width: 240px; flex: none;
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  background: rgba(255,255,255,.55);
}
aside.sidebar h3 { margin: 14px 6px 6px; font-size: 12px; color: var(--muted); text-transform: none; }
.navitem {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left; border: none; background: transparent;
  padding: 6px 8px; border-radius: 6px;
}
.navitem:hover { background: rgba(255,255,255,.8); }
.navitem.selected { background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; }
.navitem .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--chip); flex: none; }
.navitem .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.navitem .mini { margin-left: auto; display: flex; gap: 2px; }
.navitem .mini button { padding: 0 5px; font-size: 12px; border: none; background: transparent; color: var(--muted); }
.addrow { display: flex; gap: 4px; margin: 4px 0 0; }
.addrow input { flex: 1; min-width: 0; }
main.content { flex: 1; padding: 14px 18px 60px; min-width: 0; }
.archived-list { color: var(--muted); }
.archived-list .navitem { font-weight: 400; }

/* ---------- task list ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h2 { margin: 0 12px 0 0; font-size: 18px; }
.toolbar .grow { flex: 1; }
.secthead {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 4px; padding: 4px 6px;
  border-bottom: 2px solid var(--line);
}
.secthead h3 { margin: 0; font-size: 15px; }
.secthead .mini button { border: none; background: transparent; color: var(--muted); padding: 0 4px; }
table.tasks { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.tasks th, table.tasks td { padding: 6px 8px; border-bottom: 1px solid #eceff3; text-align: left; vertical-align: middle; }
table.tasks th { background: #f8fafc; font-size: 12px; color: var(--muted); }
table.tasks tr:last-child td { border-bottom: none; }
table.tasks tr.subtask td { background: #fbfcfe; }
table.tasks tr.done td { color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.datec, th.datec { white-space: nowrap; }
.starbtn { border: none; background: transparent; font-size: 17px; padding: 0 2px; color: #c3c9d1; }
.starbtn.on { color: #f59e0b; }
.modechip { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--chip); font-size: 12px; white-space: nowrap; }
.rowbtns { white-space: nowrap; }
.rowbtns button { padding: 2px 7px; font-size: 12px; }
.sub-indent { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 6px; }
.overdue { color: var(--danger); font-weight: 700; }

/* ---------- calendar ---------- */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { background: #f8fafc; color: var(--muted); font-size: 12px; padding: 6px; border-bottom: 1px solid var(--line); }
.cal td { border: 1px solid #eceff3; vertical-align: top; height: 96px; padding: 4px; cursor: pointer; }
.cal td:hover { background: #f8fafc; }
.cal td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal td.sel { background: #eff6ff; }
.cal td.dim { color: #b6bcc5; background: #fafbfc; }
.cal .dnum { font-weight: 700; font-size: 12px; }
.cal .ctask { font-size: 11px; background: var(--chip); border-radius: 4px; padding: 0 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ctask.done { text-decoration: line-through; color: var(--muted); }
.cal .more { font-size: 11px; color: var(--muted); }

/* ---------- execution ---------- */
.exec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.exec-head h2 { margin: 0; font-size: 19px; }
.running-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #052e16; color: #e7f9ee; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px;
}
.running-banner .pulse { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .25; } 100% { opacity: 1; } }
.running-banner .elapsed { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; }
.running-banner button { background: #14532d; color: #e7f9ee; border-color: #166534; }
.exec-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.exec-card.running { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.exec-card .title { font-weight: 700; font-size: 15px; }
.exec-card .meta { color: var(--muted); font-size: 12px; }
.exec-card .times { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.exec-card .times .big { font-size: 16px; font-weight: 700; }
.exec-done { margin-top: 22px; }
.exec-done h3 { color: var(--muted); }

/* ---------- panels (settings / migration / modes) ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; max-width: 760px; }
.panel h3 { margin: 0 0 10px; }
.panel form.grid { display: grid; gap: 10px; }
.panel label { display: grid; gap: 4px; font-weight: 600; }
.panel .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
table.plain { border-collapse: collapse; }
table.plain td, table.plain th { padding: 4px 8px; border-bottom: 1px solid #eceff3; text-align: left; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 12px; z-index: 50; overflow-y: auto;
}
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 640px; max-width: 100%; }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.modal form { display: grid; gap: 10px; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal label { display: grid; gap: 3px; font-weight: 600; font-size: 13px; }
.modal label .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.modal .actions .left { margin-right: auto; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #111827; color: #f9fafb; padding: 8px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 99; max-width: 90vw;
}
#toast.show { opacity: .94; }
#toast.err { background: #7f1d1d; }

@media (max-width: 760px) {
  aside.sidebar { width: 180px; }
  .modal .row2, .modal .row3 { grid-template-columns: 1fr; }
}
