[hidden] { display: none !important; }
:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1d2128; --sub: #6b7280; --line: #e6e8ec;
  --coco: #14b4f6; --aicom: #1f3a8a; --other: #8a8f98;
  --todo: #9aa1ab; --doing: #2563eb; --wait: #d97706; --done: #16a34a; --late: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Noto Sans JP', -apple-system, 'Hiragino Sans', sans-serif; font-size: 15px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
@media (pointer: coarse) { input, textarea, select, [contenteditable="true"] { font-size: 16px !important; } }

#app { max-width: 980px; margin: 0 auto; padding: 16px 14px calc(60px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px 14px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .02em; }
.today { margin: 0; color: var(--sub); font-size: 13px; }

/* まとめ（会社ごとの進み具合） */
.sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.oc { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; gap: 16px; align-items: center; cursor: pointer; transition: box-shadow .15s; }
.oc.on { box-shadow: 0 0 0 2px var(--c) inset; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 900; }
.ring b span { white-space: nowrap; }
.ring b small { font-size: 11px; font-weight: 700; }
.oc-main { flex: 1; min-width: 0; }
.oc-name { font-weight: 900; font-size: 16px; }
.oc-name span { color: var(--sub); font-weight: 500; font-size: 12px; margin-left: 6px; }
.oc-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--sub); }
.oc-nums b { color: var(--ink); font-size: 15px; margin-left: 2px; }
.oc-nums .late b { color: var(--late); }
.stack { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #eef0f3; margin-top: 8px; }
.stack i { display: block; }

/* 追加 */
.add { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 14px; }
.add textarea { width: 100%; border: 0; outline: 0; resize: none; font-size: 16px; padding: 4px 2px; background: transparent; min-height: 30px; }
.addrow { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.guess { font-size: 12px; color: var(--sub); min-height: 22px; padding: 0 2px 6px; }
.sp { flex: 1; }
.guess .chip { margin-left: 4px; }
.addrow input[type=date] { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff; max-width: 150px; }
.addrow button { border: 0; background: var(--ink); color: #fff; border-radius: 10px; padding: 7px 18px; font-weight: 700; }
.addrow button:disabled { opacity: .35; }

/* 切り替え */
.filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 12px; }
.seg { display: inline-flex; background: #eceef2; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* グループ */
.org-h { display: flex; align-items: center; gap: 8px; margin: 20px 2px 8px; font-weight: 900; font-size: 15px; }
.org-h::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.org-h span { color: var(--sub); font-weight: 500; font-size: 12px; }
.grp { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.grp-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.grp-h b { font-size: 14px; white-space: nowrap; }
.grp-bar { flex: 1; height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; min-width: 40px; }
.grp-bar i { display: block; height: 100%; background: var(--done); border-radius: 3px; }
.grp-n { font-size: 12px; color: var(--sub); white-space: nowrap; }
.grp-n .late { color: var(--late); font-weight: 700; }

.task { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.task:hover { background: #fafbfc; }
.st-btn { flex: none; border: 0; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; color: #fff; margin-top: 1px; min-width: 58px; }
.st-todo { background: var(--todo); } .st-doing { background: var(--doing); } .st-wait { background: var(--wait); } .st-done { background: var(--done); }
.t-main { flex: 1; min-width: 0; cursor: pointer; }
.t-title { word-break: break-word; }
.task.done .t-title { color: var(--sub); text-decoration: line-through; }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--sub); margin-top: 1px; }
.due.late { color: var(--late); font-weight: 700; }
.due.soon { color: var(--wait); font-weight: 700; }
.chip { display: inline-block; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); }
.more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: #fafbfc; color: var(--sub); font-size: 12px; padding: 7px; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; }

/* 状態別 */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.col { background: #eceef2; border-radius: 14px; padding: 8px; min-height: 120px; }
.col-h { display: flex; justify-content: space-between; font-weight: 900; font-size: 13px; padding: 2px 6px 8px; }
.col-h::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin: 7px 6px 0 0; }
.col-h span:first-of-type { flex: 1; }
.card { background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card .t-meta { margin-top: 4px; }
@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; }
  .col { min-height: 0; }
}

/* 編集シート */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 18, 25, .35); }
.sheet-body { position: relative; background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-body { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.x { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--sub); }
.sheet label, .f-label { display: block; font-size: 12px; font-weight: 700; color: var(--sub); margin: 10px 0 4px; }
.sheet label > input, .sheet label > textarea, .sheet select, .sheet #eCat { display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font-weight: 400; color: var(--ink); margin-top: 4px; }
.sheet textarea { resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.two label { margin-top: 10px; }
.seg.st { display: flex; }
.seg.st button { flex: 1; }
.seg.st button.on[data-v=todo] { background: var(--todo); color: #fff; }
.seg.st button.on[data-v=doing] { background: var(--doing); color: #fff; }
.seg.st button.on[data-v=wait] { background: var(--wait); color: #fff; }
.seg.st button.on[data-v=done] { background: var(--done); color: #fff; }
.muted { font-weight: 400; }
.link { border: 0; background: transparent; color: var(--doing); font-size: 13px; padding: 6px 0; }
.sheet-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.primary { border: 0; background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 26px; font-weight: 700; }
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 16px; color: var(--sub); }

/* ログイン */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; width: 100%; max-width: 340px; }
.login h1 { margin: 0 0 16px; font-size: 20px; font-weight: 900; text-align: center; }
.login label { display: block; font-size: 12px; font-weight: 700; color: var(--sub); }
.login input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.login button { width: 100%; margin-top: 14px; border: 0; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px; font-weight: 700; }
.err { color: var(--late); font-size: 13px; min-height: 1.2em; margin: 8px 0 0; }
