/* ============ コメントレイヤー ============ */
.cm-toolbar{position:fixed;top:12px;right:12px;z-index:1000;display:flex;gap:6px;background:#1f2d3d;color:#fff;padding:6px 8px;border-radius:6px;box-shadow:0 4px 14px rgba(0,0,0,.18);font-size:12px}
.cm-toolbar button{background:#2f4055;color:#fff;border:1px solid #3a4c64;padding:5px 10px;border-radius:4px;cursor:pointer;font-size:12px;font-family:inherit}
.cm-toolbar button:hover{background:#3a4e67}
.cm-toolbar button.active{background:#e67e22;border-color:#d35400}
.cm-toolbar .cm-count{padding:5px 8px;color:#b8c5d5}
body.cm-mode{cursor:crosshair}
body.cm-mode .kt-record{outline:2px dashed #e67e22;outline-offset:2px}

.cm-pin{position:absolute;width:26px;height:26px;border-radius:50% 50% 50% 0;background:#e67e22;color:#fff;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;transform:translate(-50%,-100%) rotate(-45deg);box-shadow:0 3px 6px rgba(0,0,0,.3);cursor:pointer;z-index:500;border:2px solid #fff}
.cm-pin span{transform:rotate(45deg)}
.cm-pin:hover{background:#d35400;z-index:501}
.cm-pin.selected{background:#c0392b;animation:cm-pulse 1.2s infinite}
@keyframes cm-pulse{0%,100%{box-shadow:0 3px 6px rgba(0,0,0,.3)}50%{box-shadow:0 0 0 6px rgba(230,126,34,.3)}}

.cm-popover{position:absolute;z-index:600;background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,.2);padding:10px;width:280px}
.cm-popover textarea{width:100%;min-height:70px;border:1px solid #d0d7d8;border-radius:4px;padding:6px;font-family:inherit;font-size:12px;resize:vertical;box-sizing:border-box}
.cm-popover .cm-target{font-size:11px;color:#888;margin-bottom:4px}
.cm-popover .cm-target b{color:#333}
.cm-popover .cm-author-line{font-size:11px;color:#888;margin-bottom:6px}
.cm-popover .cm-author-line b{color:#333}
.cm-popover .cm-time-val{color:#aaa}
.cm-popover .cm-actions{display:flex;justify-content:space-between;margin-top:8px;gap:6px}
.cm-popover button{padding:4px 10px;border:1px solid #c8ced0;background:#fff;border-radius:3px;cursor:pointer;font-size:12px;font-family:inherit}
.cm-popover button.primary{background:#e67e22;color:#fff;border-color:#d35400}
.cm-popover button.danger{background:#fff;color:#c0392b;border-color:#e6b4ac}

.cm-sidebar{position:fixed;top:0;right:-380px;width:360px;height:100vh;background:#fff;border-left:1px solid #ccc;box-shadow:-4px 0 12px rgba(0,0,0,.12);z-index:900;transition:right .22s ease;display:flex;flex-direction:column}
.cm-sidebar.open{right:0}
.cm-sidebar-head{padding:10px 14px;border-bottom:1px solid #e3e7e8;display:flex;align-items:center;gap:8px;background:#1f2d3d;color:#fff}
.cm-sidebar-head h3{margin:0;font-size:13px;flex:1}
.cm-sidebar-head button{background:transparent;border:none;color:#fff;cursor:pointer;font-size:16px}
.cm-sidebar-body{flex:1;overflow-y:auto;padding:8px}
.cm-item{border:1px solid #e3e7e8;border-radius:4px;padding:8px 10px;margin-bottom:8px;font-size:12px;background:#fff}
.cm-item-head{display:flex;align-items:center;gap:6px;margin-bottom:3px}
.cm-item-num{background:#e67e22;color:#fff;width:20px;height:20px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;flex-shrink:0}
.cm-item-author{color:#333;font-weight:600;font-size:11px}
.cm-item-time{color:#aaa;font-size:10px;margin-left:auto}
.cm-item-target{color:#888;font-size:11px;margin-bottom:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cm-item-text{color:#333;white-space:pre-wrap;word-break:break-word}
.cm-item-actions{margin-top:6px;display:flex;gap:6px}
.cm-item-actions button{font-size:11px;padding:2px 8px;border:1px solid #d0d7d8;background:#fff;border-radius:3px;cursor:pointer;color:#666}
.cm-item-actions button:hover{background:#f0f3f3}
.cm-item-actions button.danger{color:#c0392b;border-color:#e6b4ac}
.cm-empty{color:#aaa;font-size:12px;text-align:center;padding:20px 10px}
.cm-sidebar-foot{padding:10px 14px;border-top:1px solid #e3e7e8;background:#fafbfb;display:flex;gap:6px}
.cm-sidebar-foot button{flex:1;padding:6px;border:1px solid #c8ced0;background:#fff;border-radius:3px;cursor:pointer;font-size:12px;font-family:inherit}
.cm-sidebar-foot button.primary{background:#2ecc71;color:#fff;border-color:#27ae60}
.cm-sidebar-foot button.danger{color:#c0392b;border-color:#e6b4ac}

.cm-toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#27ae60;color:#fff;padding:10px 20px;border-radius:4px;font-size:13px;box-shadow:0 3px 12px rgba(0,0,0,.2);z-index:2000;opacity:0;transition:opacity .2s;pointer-events:none}
.cm-toast.show{opacity:1}
.cm-toast.err{background:#c0392b}

.cm-status{display:inline-block;width:10px;height:10px;border-radius:50%;margin:2px 4px 0 4px;vertical-align:middle}
.cm-status.ok{background:#2ecc71;box-shadow:0 0 4px rgba(46,204,113,.6)}
.cm-status.bad{background:#c0392b}
.cm-pin.cm-pin-temp{opacity:.7;border-style:dashed}

@media print{.cm-toolbar,.cm-sidebar,.cm-pin,.cm-popover{display:none!important}}
