:root{--bg:#f6f6f6;--card:#ffffff;--border:#e8e8e8;--text:#333;--muted:#666;--primary:#ff5443;--primary-600:#e24a3b;--accent:#4e9cff;--radius:12px;--shadow:0 10px 30px rgba(0,0,0,.08)}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial}
.container{display:flex;min-height:100vh}
.sidebar{transition:width .25s ease, opacity .22s ease, padding .2s ease, transform .25s ease}
.container.collapsed .sidebar{width:48px;padding:8px;opacity:1;border-right:1px solid var(--border);pointer-events:auto}
.container.collapsed .content{width:100%}
.sidebar{width:280px;border-right:1px solid var(--border);background:#fff;display:flex;flex-direction:column;gap:16px;padding:16px;will-change:transform}
/* override: reduce top padding to move user block up */
.sidebar{padding:8px 16px}
.side-actions{display:flex;justify-content:flex-end}
.side-actions #exportBtn, .side-actions #importBtn{display:inline-flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:#fff;color:#333;cursor:pointer;transition:all .15s ease}
#exportBtn{background:#e9f2ff;border-color:#4e9cff;color:#0b63c9}
#exportBtn:hover{box-shadow:0 4px 12px rgba(78,156,255,0.22);transform:translateY(-1px)}
#importBtn{background:#eafbe7;border-color:#22c55e;color:#15803d}
#importBtn:hover{box-shadow:0 4px 12px rgba(34,197,94,0.22);transform:translateY(-1px)}
.content{flex:1;display:flex;flex-direction:column}
.user{display:flex;flex-direction:column;gap:8px}
.user-top{display:flex;align-items:center;gap:10px;justify-content:space-between}
.avatar{width:40px;height:40px;border-radius:50%;background:#ffe6e2;display:flex;align-items:center;justify-content:center;font-size:20px}
.collapse-toggle{border:1px solid var(--border);border-radius:50%;background:#fff;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.collapse-toggle:hover{background:#f8f8f8}
.collapse-toggle-fixed{position:fixed;top:12px;left:12px;z-index:50}
.meta{display:flex;align-items:center;gap:8px}
.name{font-weight:600}
.bell{font-size:18px}
.btn.add.icon{align-self:flex-start;background:var(--primary);color:#fff;font-weight:700}
.nav{display:flex;flex-direction:column;gap:6px}
.nav-item{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border:none;border-radius:8px;background:transparent}
.nav-item.active{background:#f3f3f3;color:var(--primary)}
.nav-item:hover{background:#f7f7f7;color:var(--primary)}
.count{color:var(--muted)}
.projects{display:flex;flex-direction:column;gap:8px}
.projects .title{color:var(--muted);font-size:12px;display:flex;align-items:center;gap:6px}
.projects .title .icon-btn:first-of-type{margin-left:auto}
.project-item{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border-radius:10px}
.project-item:hover{background:#f8f8f8}
.project-dot{width:10px;height:10px;border-radius:50%;display:inline-block;margin-right:6px}
.filters{display:flex;flex-direction:column;gap:12px;padding:14px 20px;border-bottom:1px solid var(--border);background:#fff}
.filter-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.label{color:var(--muted);font-size:13px}
.input,.select{padding:10px 12px;border:1px solid var(--border);border-radius:10px;min-width:180px;background:#fff}
.btn{padding:10px 14px;border:1px solid var(--border);border-radius:10px;background:#fff;color:var(--text);font-weight:500;transition:all .15s cubic-bezier(0.4,0,0.2,1)}
.btn:hover{background:#fafafa;border-color:#ccc;box-shadow:0 4px 12px rgba(0,0,0,.06);transform:translateY(-1px)}
.btn:active{background:#f4f4f4;transform:scale(0.98) translateY(0)}
.btn.primary{background:var(--primary);color:#fff;border-color:transparent;box-shadow:0 4px 12px rgba(255,84,67,0.25)}
.btn.primary:hover{background:var(--primary-600);box-shadow:0 6px 16px rgba(255,84,67,0.35);transform:translateY(-1px)}
.btn.primary:active{transform:scale(0.98) translateY(0)}
.sort-group{display:flex;flex-wrap:wrap;gap:8px}
.pill{padding:8px 12px;border:1px solid var(--border);border-radius:999px;background:#fff;color:#333;font-size:13px;transition:all .12s ease}
.pill:hover{border-color:var(--primary);color:var(--primary)}
.pill.active{background:var(--primary);border-color:var(--primary);color:#fff}
.grid{display:block;padding:8px 0}
.board-section{width:100%;max-width:100%;margin:0;background:transparent}
.board-section:first-child{margin-top:12px}
.board-header{max-width:860px;margin:0 auto;display:flex;justify-content:space-between;align-items:center;padding:6px 12px;border-bottom:none}
.board-title{font-weight:700}
.board-title .resched-btn{margin-left:8px}
.resched-btn{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border:1px solid var(--border);border-radius:999px;background:#e9f2ff;color:#0b63c9;font-size:12px;line-height:1;cursor:pointer;transition:all .15s ease}
.resched-btn:hover{background:#dfefff;border-color:#4e9cff;box-shadow:0 2px 8px rgba(78,156,255,0.18);transform:translateY(-1px)}
.resched-btn:active{transform:scale(0.98)}
.board-body{display:block}
.board-body .todo-row{max-width:860px;margin:0 auto}
.board-body .add-row{max-width:860px;margin:12px auto 24px}
.topbar{position:relative;display:flex;justify-content:center;align-items:center;padding:12px 16px;background:var(--bg);}
.topbar .title-wrap{margin:0 auto}
#layoutBtn{position:absolute;right:12px;top:50%;transform:translateY(-50%)}
.title-wrap{display:flex;gap:10px;align-items:baseline}
.muted{color:#888;font-size:13px}
.todo-row{display:flex;align-items:flex-start;gap:8px;padding:8px 10px;border-bottom:1px solid var(--border);max-width:860px;margin:0 auto;position:relative}
.drag-handle{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:#999;opacity:.5;cursor:crosshair;user-select:none;margin-top:2px}
.todo-row:hover .drag-handle{opacity:1}
.drag-handle::after{content:"⋮⋮";font-size:14px;line-height:1}
.drag-preview{background:#fff;border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px rgba(0,0,0,0.12),0 4px 12px rgba(0,0,0,0.06);opacity:.95;transform:translateY(-2px)}
.subtasks-inline{margin-left:24px;display:flex;flex-direction:column;gap:6px}
.subtask-inline-row{display:flex;align-items:center;gap:8px;padding:6px 8px;border:1px solid var(--border);border-radius:8px;background:#fff}
.subtask-inline-title{flex:1;font-size:13px;color:#555}
/* Insert line indicator */
.todo-row {
    transition: padding 0.25s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s;
}

.todo-row.drag-over-top {
    padding-top: 70px !important;
    background: #fafafa;
}

.todo-row.drag-over-bottom {
    padding-bottom: 70px !important;
    background: #fafafa;
}

.todo-row.drag-over-top::before {
    content: "松开以插入任务";
    position: absolute;
    left: 12px;
    right: 12px;
    top: 10px;
    height: 50px;
    border: 2px dashed #4e9cff;
    border-radius: 10px;
    background: rgba(78, 156, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4e9cff;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.todo-row.drag-over-bottom::after {
    content: "松开以插入任务";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    height: 50px;
    border: 2px dashed #4e9cff;
    border-radius: 10px;
    background: rgba(78, 156, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4e9cff;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
.todo-title{font-size:14px;font-weight:normal;color:#333;margin-bottom:2px}
 .todo-item{display:flex;flex-direction:column;gap:3px;flex:1}
 .item-top{display:flex;align-items:center;gap:3px}
.item-bottom{display:flex;justify-content:space-between;align-items:center;gap:8px;color:#888;font-size:10px}
 .item-desc{color:#555;font-size:12px}
 .item-desc p{margin:1px 0}
.due{font-weight:600}
.due-ok{color:#22c55e}
.due-over{color:#e24a3b}
 .item-desc{color:#555;font-size:12px}
.item-tags{display:flex;flex-wrap:wrap;gap:8px}
.tag{display:inline-flex;align-items:center;gap:6px;padding:0;border-radius:0;background:transparent;color:#888;border:none;line-height:1.6;font-size:11px;white-space:normal}
.item-tags .tag{cursor:pointer}
.tag .dot{width:8px;height:8px;border-radius:50%}
.todo-meta{display:flex;gap:10px;align-items:center;color:#666;font-size:13px}
.meta-item{display:flex;gap:6px;align-items:center}
.todo-row.complete-out{transform:translateY(8px) scale(.98);opacity:0;transition:transform .18s ease, opacity .18s ease}
.todo-title.done{opacity:.6;text-decoration:line-through}
.todo-actions{display:flex;gap:8px}
.todo-circle{width:16px;height:16px;border-radius:4px;display:inline-block;border:2px solid var(--border);cursor:pointer;margin-top:2px;}
.todo-circle.done{background:currentColor}
.todo-circle.p1{border-color:#ff5443}
.todo-circle.p2{border-color:#ff9f43}
.todo-circle.p3{border-color:#4e9cff}
.todo-circle.p4{border-color:#bbb}
.card:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(0,0,0,.06)}
.card-header{display:flex;justify-content:space-between;align-items:flex-start;padding:14px}
.title{font-weight:600}
.badge{font-size:12px;border-radius:8px;padding:4px 8px;border:1px solid var(--border);color:var(--muted)}
.card-body{padding:0 14px 14px;color:#555}
.card-footer{display:flex;gap:10px;padding:14px;border-top:1px solid var(--border)}
.card-footer .btn{min-height:44px}
.done{opacity:.6;text-decoration:line-through}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.2);display:flex;align-items:flex-start;justify-content:center;overflow-y:auto;padding-bottom:40px;z-index:3000}
.modal.hidden{display:none}
.modal-body{width:96%;max-width:860px;background:#fff;border-radius:14px;box-shadow:var(--shadow);padding:20px;display:flex;flex-direction:column;gap:12px;margin-top:10vh;opacity:0;transform:translateY(8px);transition:opacity .18s ease, transform .18s ease}
.modal.open .modal-body{opacity:1;transform:translateY(0)}
.task-form{display:flex;flex-direction:column;gap:14px}
.row.top .label{font-weight:600;margin-bottom:6px}
.title-line{display:flex;gap:10px;align-items:center}
.title-line .icon-btn{height:44px}
.input.large{flex:1;padding:12px 14px;font-size:16px;line-height:1.6}
.icon-btn{padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:#fff}
.menu{background:#fff;border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);padding:6px;min-width:160px}
.topbar{position:relative}
#layoutMenu{position:absolute;right:12px;top:calc(100% + 6px);z-index:1000}
.menu .menu-item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px;cursor:pointer}
.menu .menu-item:hover{background:#f8f8f8}
.flag{width:14px;height:14px;border-radius:2px;display:inline-block}
.flag-red{background:#ff5443}
.flag-orange{background:#ff9f43}
.flag-blue{background:#4e9cff}
.flag-gray{background:#bbb}
.popover{position:absolute;background:#fff;border:1px solid rgba(0,0,0,0.06);border-radius:12px;box-shadow:0 12px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.04);padding:8px;z-index:20;transition:opacity .15s ease, transform .15s ease, top 0s, left 0s;will-change:transform, opacity}
.popover.pop-up {
  top: auto !important;
  bottom: calc(100% + 8px) !important;
  transform-origin: bottom left;
}
.chips{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.chip{padding:8px 12px;border-radius:999px;border:1px solid var(--border);background:#fff;cursor:pointer;transition:background-color .12s ease,border-color .12s ease}
.chip .close{margin-left:8px;color:var(--muted)}
.row.middle .field{display:flex;flex-direction:column;gap:6px}
.more{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
.more.hidden{display:none}
.row.bottom{display:flex;justify-content:space-between;align-items:center;gap:10px}
.row.bottom .btn{height:40px}
.side-actions .collapse-toggle{height:40px;width:40px}
.collapse-toggle{aspect-ratio:1/1}
.btn.blue{background:#4e9cff;color:#fff;border-color:#4e9cff}
.modal-actions{display:flex;gap:10px;justify-content:flex-end}
@media (max-width:640px){.grid{grid-template-columns:1fr}.filters{gap:10px}.input,.select{min-width:140px}.topbar{padding:12px 14px}}
/* Mobile slide-in sidebar */
@media (max-width:960px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:40;width:280px;transform:translateX(0);border-right:1px solid var(--border);opacity:1;padding:12px}
  .container.collapsed .sidebar{width:56px;transform:none;padding:8px}
  .container:not(.collapsed) .sidebar{width:280px}
  .container{min-height:auto}
}
@media (max-width:820px){.todo-row{max-width:100%}.todo-meta{flex-wrap:wrap}}
@media (max-width:820px){
  .board-body .todo-row{max-width:100%;margin:0 auto}
  .board-body .add-row{max-width:100%;margin:12px auto 24px}
}
.loader{position:fixed;right:20px;bottom:20px;background:#000;color:#fff;padding:8px 12px;border-radius:10px;opacity:.8}
.hidden{display:none}
 
/* project color block clickable feedback */
.project-item .project-dot{cursor:pointer;box-shadow:0 0 0 0 rgba(78,156,255,.0);transition:box-shadow .12s ease}
.project-item .project-dot:hover{box-shadow:0 0 0 3px rgba(78,156,255,.15)}
/* modal sections */
.row{padding-top:8px;margin-top:8px;border-top:1px solid var(--border)}
.row.top{border-top:none;margin-top:0;padding-top:0}
@media (max-width:640px){
  .item-tags{grid-template-columns:1fr}
}
.card.complete-out{transform:translateY(8px) scale(.98);opacity:0;transition:transform .18s ease, opacity .18s ease}
.subtasks{margin-top:10px}
.subtasks-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.subtasks-list{display:flex;flex-direction:column;gap:6px}
.subtree{display:flex;flex-direction:column;gap:6px}
.tree-item{display:flex;flex-direction:column;gap:6px}
.tree-item>.subtask-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:#fff}
.subtree-children{margin-left:18px;display:flex;flex-direction:column;gap:6px}
.tree-toggle{display:inline-flex;align-items:center;justify-content:center;width:16px;color:#888}
.tree-toggle.empty{opacity:.5}
.subtask-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:#fff}
.subtask-item[draggable=true]{user-select:none}
.subtask-title{flex:1}
.subtask-delete{border:none;background:transparent;color:#999;cursor:pointer}
/* subtask add form */
.subtask-add-row{display:flex;flex-direction:column;gap:8px;margin-top:6px;border:1px solid var(--border);border-radius:10px;padding:10px;background:#fff}
.subtask-add-row .input{flex:1}
.subtask-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.subtask-actions{margin-left:0;display:flex;gap:8px}
/* add-row at bottom */
.add-row{display:flex;justify-content:center;align-items:center;padding:12px;border:1px solid transparent;border-radius:10px;max-width:860px;margin:12px auto 24px;cursor:pointer;color:#888;background:transparent}
.add-row:hover{background:#f3f3f3;color:#333}
/* hide small add board button and show hover banner in grid */
 
.add-board-banner{display:flex;justify-content:center;align-items:center;margin:0 auto;padding:0;max-width:860px;height:32px;opacity:0;transition:all .2s ease;border-radius:10px;cursor:pointer;color:#0b63c9;border-top:1px solid transparent;border-bottom:1px solid transparent}
.add-board-banner:hover{opacity:1;background:#e9f2ff;border-color:#4e9cff}
#sidebar .nav, #sidebar .projects, #sidebar .btn.add.icon{ }
.container.collapsed #sidebar .nav, .container.collapsed #sidebar .projects, .container.collapsed #sidebar .btn.add.icon, .container.collapsed #sidebar .user .meta, .container.collapsed #sidebar .user .avatar{display:none}
.container.collapsed #sidebar .user-top{justify-content:center}
.board-menu-btn{border:1px solid var(--border);background:#fff;border-radius:6px;padding:6px 8px;cursor:pointer}
/* Comments */
.comments-panel{max-width:100%;margin:16px 0;padding:16px 18px;background:#fff;border:1px solid var(--border);border-radius:12px}
.comments-list{display:flex;flex-direction:column;gap:10px;margin-bottom:8px}
.comment-row{display:flex;flex-direction:column;gap:8px;border:none;border-radius:10px;padding:12px 14px;margin:0 2px}
.comment-meta{color:#888;font-size:12px}
.comment-content{color:#333;font-size:13px;padding:2px 4px}
.comment-content h1,.comment-content h2,.comment-content h3{position:relative;padding-left:14px;margin:10px 0 8px;line-height:1.35}
.comment-content h1{font-size:1.5em;font-weight:700;color:#1f2d3d}
.comment-content h2{font-size:1.3em;font-weight:600;color:#243447}
.comment-content h3{font-size:1.15em;font-weight:600;color:#2f3b4a}
.comment-content h1::before{content:"";position:absolute;left:0;top:2px;bottom:2px;width:4px;background:linear-gradient(180deg,#4e9cff,#3a7bd5);border-radius:2px}
.comment-content h2::before{content:"";position:absolute;left:0;top:3px;bottom:3px;width:3px;background:linear-gradient(180deg,#79b3ff,#4e9cff);border-radius:2px}
.comment-content h3::before{content:"";position:absolute;left:0;top:4px;bottom:4px;width:2px;background:#a6c8ff;border-radius:2px}
.comment-content h1,.comment-content h2,.comment-content h3{margin:10px 0 6px;font-weight:700;color:#222}
.comment-content p{margin:6px 0;line-height:1.7}
.comment-content blockquote{border-left:3px solid #4e9cff;background:#f7fbff;padding:6px 10px;border-radius:6px;color:#245ea6;margin:6px 0}
.comment-content ul,.comment-content ol{margin:6px 0 6px 18px}
.comment-content li{margin:3px 0}
.comment-content ul.task-list{list-style:none;padding-left:0}
.comment-content ul.task-list li{display:flex;align-items:flex-start;gap:8px}
.comment-content ul.task-list input[type=checkbox]{margin-top:2px}
.comment-content code{background:#f1f3f6;border:1px solid #e6e9ef;border-radius:4px;padding:2px 4px;font-family:Consolas,Menlo,Monaco,monospace;color:#1f2937}
.comment-content pre{background:#f6f8fa;color:#24292e;border-radius:8px;padding:12px 14px;overflow:auto;border:1px solid #e1e4e8}
.comment-content pre code{background:transparent;border:none;padding:0;color:inherit;white-space:pre}
.comment-content hr{border:none;border-top:1px solid #e1e4e8;margin:12px 0}
.comment-content a{color:#0969da;text-decoration:none}
.comment-content a:hover{text-decoration:underline}
.comment-content table{width:100%;border-collapse:collapse;margin:8px 0;border:1px solid #e6e6e6;border-radius:8px;overflow:hidden}
.comment-content th,.comment-content td{border:1px solid #e6e6e6;padding:8px 10px;font-size:12px;color:#333}
.comment-content thead th{background:#f2f6ff;color:#0b63c9}
.comment-content tbody tr:nth-child(odd){background:#fafafa}
.comment-content img{max-width:100%;border-radius:8px}
.comment-content .md-math{display:inline-block;padding:0 4px;border-radius:4px;background:#f6f8fa;border:1px solid #e1e4e8;font-family:Cambria, 'Times New Roman', serif;color:#0f172a}
.comment-content .md-math-block{display:block;padding:10px 12px;margin:8px 0;border-radius:8px;background:#f6f8fa;border:1px solid #e1e4e8;font-family:Cambria, 'Times New Roman', serif;color:#0f172a}
.comment-editor{display:flex;flex-direction:column;gap:8px}
.comment-tools{display:flex;gap:8px;align-items:center;justify-content:flex-end}
.comment-editor #commentInput{min-height:140px;padding:8px;border:1px solid var(--border);border-radius:8px;resize:vertical;width:100%}
.clip-btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border:1px solid var(--border);border-radius:50%;cursor:pointer;background:#fff}
.clip-btn:hover{background:#f8f8f8}
.attach-preview{display:flex;flex-wrap:wrap;gap:8px}
.attach-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border:1px solid var(--border);border-radius:8px;font-size:12px;color:#555}
/* Attach items */
.attach-item{display:flex;align-items:center;gap:8px;border:1px dashed var(--border);padding:6px;border-radius:8px}
.attach-item .thumb{width:40px;height:40px;border-radius:6px;overflow:hidden;background:#f5f5f5;display:flex;align-items:center;justify-content:center}
.attach-item .thumb img{width:100%;height:100%;object-fit:cover}
.attach-item .file-icon{font-size:20px}
.attach-item .meta{font-size:12px;color:#555}
.attach-item .progress{flex:1;height:6px;background:#eee;border-radius:6px;overflow:hidden}
.attach-item .progress .bar{height:100%;width:0;background:#4e9cff;transition:width .2s ease}
.comment-preview{border:1px solid var(--border);border-radius:8px;padding:8px;color:#333}
.comment-attaches{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.comment-attaches .attach-link{font-size:12px;color:#0b63c9;text-decoration:none}
.comment-attaches .attach-link:hover{text-decoration:underline}
@media (max-width:640px){
  .comment-tools{justify-content:space-between}
  .attach-item{flex-wrap:wrap}
}
/* Quick Add Modal Styles */
.quick-add-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 860px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  margin-top: 60px;
  padding: 10px;
}

.qa-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qa-row-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.qa-title-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px; /* Reduced from 20px */
  font-weight: 700;
  background: transparent;
  padding: 0;
  line-height: 1.4;
}
.qa-title-input::placeholder {
  color: #aaa;
}

.qa-right-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-badge {
  font-size: 12px;
  color: #4e9cff;
  background: rgba(78,156,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.qa-voice-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  padding: 4px;
  cursor: pointer;
  color: #4e9cff;
}

.qa-desc-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 13px; /* Reduced from 14px */
  color: #555;
  min-height: 20px;
  max-height: 120px;
  overflow-y: auto;
  padding: 0;
  background: transparent;
}

.qa-row-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  position: relative;
}

.parent-link-bar{
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7fbff;
  border: 1px solid #d1e3ff;
  color: #0b63c9;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.parent-link{
  font-weight: 600;
  color: #0b63c9;
  text-decoration: none;
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.parent-link:hover{ color: #084b97; text-decoration: underline; }
.parent-link:visited{ color: #5b8fd6; }
.parent-hint{ color: #0b63c9; opacity: .9; }

@media (max-width:640px){
  .parent-link-bar{ padding: 12px; border-radius: 12px; }
  .parent-link{ max-width: 60%; }
}

/* Priority Menu Positioning */
#priorityMenu {
  top: calc(100% + 8px);
  left: 0;
  min-width: 150px;
}
#priorityMenu .menu {
  box-shadow: none;
  border: none;
  padding: 0;
  background: transparent;
}

/* Right Positioning */
.popover.pop-right {
  left: calc(100% + 8px) !important;
  top: 0 !important;
  bottom: auto !important;
  transform-origin: top left;
}
.popover.pop-right.pop-up {
    top: auto !important;
    bottom: 0 !important;
    transform-origin: bottom left;
}

/* Date Picker Styles */
.date-popover {
  top: calc(100% + 8px);
  left: 0;
  z-index: 3500;
  width: 240px;
  padding: 0;
  border-radius: 12px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.08);
  max-height: 85vh;
  animation: dpFade .12s ease;
  background: #fff;
}

.date-popover::after{content:"";position:absolute;left:18px;top:-8px;border-width:8px 8px 0 8px;border-style:solid;border-color:#fff transparent transparent transparent;filter:drop-shadow(0 2px 2px rgba(0,0,0,0.08))}
.date-popover.pop-up::after{top:auto;bottom:-8px;border-width:0 8px 8px 8px;border-color:transparent transparent #fff transparent}
.date-popover.pop-right::after{left:auto;right:12px}

@keyframes dpFade{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}

.datepicker-input-row {
  padding: 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.datepicker-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  color: #333;
  background: transparent;
}

.datepicker-presets {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  flex-shrink: 0; 
}

.dp-preset {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: background 0.1s, color .1s;
  border-radius: 8px;
}
.dp-preset:hover {
  background: #e9f2ff;
  color: #0b63c9;
}
.dp-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dp-icon-s {
  width: 16px;
  text-align: center;
}
.dp-meta {
  font-size: 12px;
  color: #999;
}

.datepicker-calendar {
  padding: 12px 16px;
  flex: 1;
  overflow-y: auto;
  min-height: 135px;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.datepicker-calendar::-webkit-scrollbar {
  width: 6px;
}
.datepicker-calendar::-webkit-scrollbar-thumb {
  background-color: #ddd;
  border-radius: 3px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cal-title {
  font-weight: 600;
  font-size: 13px;
}
.cal-nav {
  display: flex;
  gap: 4px;
}
.cal-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #666;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.cal-btn:hover {
  background: #f0f0f0;
  border-color: #e0e0e0;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
  font-weight: 500;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  border-radius: 8px;
  color: #333;
  transition: all 0.1s;
}
.cal-day:hover {
  background: #f0f0f0;
}
.cal-day.other-month {
  color: #ccc;
}
.cal-day.today {
  color: #4e9cff;
  font-weight: 700;
  background: rgba(78,156,255,0.1);
}
.cal-day.selected {
  background: #4e9cff;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(78,156,255,0.25);
}

.datepicker-footer {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  background: #fafafa;
  flex-shrink: 0;
}

.dp-footer-btn {
  flex: 1;
  height: 44px; /* Min height requirement */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
}

/* Compact Edit Layout */
.edit-layout-compact {
  display: block;
  width: 100%;
}

.qa-meta-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 10px;
}

.qa-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
}

/* Ensure project picker looks good in the top right */
.qa-project-select {
  position: relative;
}

/* Project Picker Dropdown */
.project-picker-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: -8px;
  top: auto;
  right: auto;
  width: 240px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  z-index: 100;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-picker-dropdown.hidden {
  display: none;
}

.pp-search-wrap {
  padding: 0 4px;
}

.pp-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.pp-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pp-item {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.pp-item:hover {
  background: #f6f6f6;
}

.pp-board-item {
  padding: 6px 12px 6px 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
}

.pp-board-item:hover {
  background: #f6f6f6;
  color: #333;
}

.dp-footer-btn:hover {
  background: #fff;
  border-color: #ccc;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.dp-footer-btn:active {
  transform: translateY(0);
  background: #f5f5f5;
}
/* Priority / Chip buttons optimization */
.chip-btn {
  height: 36px; /* Increased touch target */
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #555;
  font-size: 14px;
  transition: all 0.15s ease;
}
.chip-btn:hover {
  border-color: #b0b0b0;
  background: #fafafa;
  color: #333;
}
.chip-btn.active {
  background: rgba(78,156,255,0.1);
  border-color: #4e9cff;
  color: #4e9cff;
}
.chip-btn:active {
  background: #f0f0f0;
  transform: scale(0.98);
}

/* Primary Action Button (e.g. inside Time Picker) */
#dpTimeConfirm, .btn-primary-action {
    background: var(--primary);
    color: #fff;
    border: none;
    font-weight: 600;
}
#dpTimeConfirm:hover {
    background: var(--primary-600);
    box-shadow: 0 4px 12px rgba(255,84,67,0.3);
}

.dp-footer-btn {
  flex: 1;
  padding: 6px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 13px;
  cursor: pointer;
}
.dp-footer-btn:hover {
  background: #f9f9f9;
  color: #333;
}
.dp-footer-btn.active{
  background: rgba(78,156,255,0.1);
  border-color: #4e9cff;
  color: #4e9cff;
}

.time-picker-panel {
  padding: 10px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.time-picker-list{max-height:150px;overflow-y:auto;border:1px solid #eee;border-radius:6px;width:140px}
.time-option{padding:6px 10px;cursor:pointer;font-size:13px;line-height:1;border-bottom:1px solid #eee}
.time-option:last-child{border-bottom:none}
.time-option:hover{background:#f5f5f5}


.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip-btn:hover {
  background: #f8f8f8;
  border-color: #ddd;
  color: #333;
}
.chip-btn.active {
  background: rgba(78,156,255,0.1);
  color: #4e9cff;
  border-color: #4e9cff;
}
.nlp-bar{margin-top:8px;padding:8px 10px;border:1px dashed #4e9cff;border-radius:6px;background:#f7fbff;color:#245ea6;display:flex;gap:10px;align-items:center}
.chip-btn .close {
  margin-left: 4px;
  color: #999;
  font-size: 14px;
}
.chip-btn .close:hover {
  color: #ff5443;
}

.more-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-top: 8px;
}
.more-panel .input {
  font-size: 13px;
  padding: 8px;
}

.qa-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
  border-radius: 0 0 14px 14px;
}

.qa-footer-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Edit panel layout */
.edit-layout{display:grid;grid-template-columns:1fr 300px;gap:16px}
.task-form.inline-mode .edit-layout{display:block}
.edit-main{display:flex;flex-direction:column;gap:12px}
.edit-side{display:flex;flex-direction:column;gap:14px;border-left:1px solid var(--border);padding-left:14px}
.task-form.inline-mode .edit-side{display:none}
.side-field{display:flex;flex-direction:column;gap:6px;position:relative}
.side-actions{display:flex;gap:10px;justify-content:flex-end;align-items:center;margin-top:6px}

.qa-project-select .select-clean {
  border: none;
  background: transparent;
  font-weight: 600;
  color: #555;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
}
.qa-project-select .select-clean:hover {
  background: #f5f5f5;
}

.qa-actions {
  display: flex;
  gap: 10px;
}

.btn-clean {
  border: none;
  background: transparent;
  padding: 8px 16px;
  color: #666;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}
.btn-clean:hover {
  background: #f5f5f5;
}

.btn-primary {
  border: none;
  background: #4e9cff; /* Matching blue theme */
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(78,156,255,0.3);
}
.btn-primary:hover {
  background: #3b89ec;
}

.btn-text {
  border: none;
  background: transparent;
  color: #4e9cff;
  cursor: pointer;
  font-size: 13px;
}
.btn-text:hover {
  text-decoration: underline;
}

/* Hide hidden elements */
.hidden { display: none !important; }

.project-modal{max-width:420px;padding:22px;border:1px solid var(--border);border-radius:16px}
.pm-header{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.pm-icon{width:36px;height:36px;border-radius:8px;background:#e9f2ff;color:#0b63c9;display:flex;align-items:center;justify-content:center;font-weight:700}
.pm-texts{display:flex;flex-direction:column;gap:2px}
.pm-title{font-weight:700}
.pm-sub{color:#888;font-size:12px}
.pm-input-row{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.pm-input{font-size:15px;padding:12px 14px;border-radius:12px}
/* Board modal modern styles */
.bm-header{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.bm-icon{width:36px;height:36px;border-radius:8px;background:#e9f2ff;color:#0b63c9;display:flex;align-items:center;justify-content:center;font-weight:700}
.bm-texts{display:flex;flex-direction:column;gap:2px}
.bm-title{font-weight:700}
.bm-sub{color:#888;font-size:12px}
.bm-input-row{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.bm-input-wrap{display:flex;align-items:center;gap:6px}
.bm-input{font-size:15px;padding:12px 14px;border-radius:12px}
.input-feedback{min-height:18px;font-size:12px;color:#e24a3b}
.input.invalid{border-color:#e24a3b;box-shadow:0 0 0 3px rgba(226,74,59,.12)}

.edit-layout-compact {
    display: block;
    width: 100%;
}

/* Modern Custom Repeat Modal */
.modern-cr-modal {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    transform-origin: center;
    animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.cr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cr-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.cr-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cr-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cr-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.cr-freq-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f9f9f9;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.cr-text-prefix {
    padding-left: 12px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.cr-input-num {
    width: 80px;
    border: none;
    background: #fff;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.cr-select {
    flex: 1;
    border: none;
    background: #fff;
    font-size: 14px;
    color: #333;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
}

.cr-end-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cr-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #eee;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.cr-option-card:hover {
    background: #fcfcfc;
    border-color: #ddd;
}

.cr-option-card.selected {
    background: #f0f7ff;
    border-color: #4e9cff;
}

.cr-option-card input[type="radio"] {
    display: none;
}

.cr-option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cr-option-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.cr-option-desc {
    font-size: 12px;
    color: #888;
}

.cr-date-input {
    margin-top: 6px;
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    width: 140px;
    transition: all 0.2s;
}

.cr-date-input:disabled {
    background: #f5f5f5;
    color: #aaa;
    border-color: #eee;
    cursor: not-allowed;
}

.cr-check-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    position: relative;
    transition: all 0.2s;
}

.cr-option-card.selected .cr-check-icon {
    border-color: #4e9cff;
    background: #4e9cff;
}

.cr-option-card.selected .cr-check-icon::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.cr-summary {
    background: #f5f9ff;
    color: #4e9cff;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

.cr-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}
.comment-del{border:none;background:transparent;color:#999;cursor:pointer}
.comment-del:hover{color:#e24a3b}

/* Comment editor enhanced markdown rendering inside input */
.comment-editor{display:flex;flex-direction:column;gap:8px}
#commentHighlight{
  position:absolute;left:0;right:0;top:0;
  padding:8px;border:1px solid var(--border);
  border-radius:8px;background:#fff;color:#333;
  font-size:13px;line-height:1.4;white-space:normal;word-break:break-word;overflow-wrap:anywhere;overflow:hidden;
  pointer-events:none;z-index:0;
}
#commentHighlight table{ width:100%; border-collapse:collapse; }
#commentHighlight th,#commentHighlight td{ border:1px solid #e0e0e0; padding:6px 8px; }
#commentHighlight hr{ border:0; border-top:1px solid #e0e0e0; margin:8px 0; }
#commentInput{
  position:relative;z-index:1;background:transparent;
  padding:8px;border:1px solid var(--border);
  border-radius:8px;font-size:13px;line-height:1.4;
  min-height:32px; max-height:160px; transition:height 160ms ease;
}
.comment-editor #commentInput::placeholder{ color: transparent; }
.md-bold{font-weight:700}
.md-italic{font-style:italic}
.md-code{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;background:#f6f8fa;padding:0 3px;border-radius:3px}
.md-heading{font-weight:600}
.md-placeholder{color:#999}
.md-link{ color:#245ea6; text-decoration:underline; }
.md-list{ margin:6px 0 6px 18px; }
.md-p{ margin:4px 0; }
.md-h{ margin:6px 0; }
.md-table{ width:100%; border-collapse:collapse; }
.md-table th,.md-table td{ border:1px solid #e0e0e0; padding:6px 8px; }
.md-hr{ border:0; border-top:1px solid #e0e0e0; margin:8px 0; }
h1,h2,h3,h4,h5,h6{ line-height:1.4 }
#commentHighlight h1{font-size:1.2em}
#commentHighlight h2{font-size:1.15em}
#commentHighlight h3{font-size:1.12em}
#commentHighlight h4{font-size:1.1em}
#commentHighlight h5{font-size:1.06em}
#commentHighlight h6{font-size:1.03em}

@media (max-width:640px){
  #commentInput,#commentHighlight{font-size:14px}
}
.btn-primary.disabled{ opacity:0.6; cursor:not-allowed; }

/* Markdown Editor & Emoji Picker */
.comment-editor-wrapper {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.comment-editor-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 84, 67, 0.1);
}
.markdown-editor {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.markdown-editor:empty:before {
  content: attr(placeholder);
  color: #aaa;
  pointer-events: none;
}
/* Markdown Styles in Editor */
.markdown-editor h1, .markdown-editor h2, .markdown-editor h3 {
  margin: 0.5em 0;
  font-weight: 600;
  line-height: 1.3;
}
.markdown-editor h1 { font-size: 1.6em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.markdown-editor h2 { font-size: 1.4em; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.markdown-editor h3 { font-size: 1.2em; }
.markdown-editor strong { font-weight: 700; }
.markdown-editor em { font-style: italic; }
.markdown-editor del { text-decoration: line-through; opacity: 0.7; }
.markdown-editor code {
  font-family: monospace;
  background: rgba(0,0,0,0.05);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
  color: #e83e8c;
}
.markdown-editor pre {
  background: #f6f8fa;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
}
.markdown-editor pre code { background: none; color: inherit; padding: 0; }
.markdown-editor blockquote {
  border-left: 4px solid #ddd;
  margin: 0;
  padding-left: 12px;
  color: #666;
}
.markdown-editor ul, .markdown-editor ol { padding-left: 20px; margin: 0.5em 0; }
.markdown-editor a { color: var(--primary); text-decoration: none; }
.markdown-editor a:hover { text-decoration: underline; }

.markdown-editor h1 { font-size: 1.6em; font-weight: bold; margin: 0.5em 0; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.markdown-editor h2 { font-size: 1.4em; font-weight: bold; margin: 0.5em 0; border-bottom: 1px solid #eee; padding-bottom: 0.3em; }
.markdown-editor h3 { font-size: 1.25em; font-weight: bold; margin: 0.4em 0; }
.markdown-editor h4 { font-size: 1.1em; font-weight: bold; margin: 0.4em 0; }
.markdown-editor h5 { font-size: 1em; font-weight: bold; margin: 0.4em 0; }
.markdown-editor h6 { font-size: 0.9em; color: #777; margin: 0.4em 0; }
.markdown-editor p { margin: 0.5em 0; }
.markdown-editor { line-height: 1.6; }

.comment-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  color: #666;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); color: #333; }
.clip-btn {
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  color: #666;
  display: flex;
  align-items: center;
}
.clip-btn:hover { background: rgba(0,0,0,0.05); color: #333; }
#commentSendBtn {
  margin-left: auto;
  padding: 6px 16px;
  font-size: 13px;
}

/* Emoji Picker */
.emoji-picker {
  position: fixed;
  width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 10000;
  display: flex;
  flex-direction: column;
}
.emoji-picker.hidden { display: none; }
.emoji-nav {
  display: flex;
  overflow-x: auto;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}
.emoji-nav-item {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 18px;
  transition: background 0.2s;
}
.emoji-nav-item:hover, .emoji-nav-item.active { background: #f0f0f0; }
.emoji-list { flex: 1; padding: 8px; }
.emoji-category-title {
  font-size: 12px;
  color: #999;
  margin: 8px 0 4px;
  padding-left: 4px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-item {
  cursor: pointer;
  font-size: 20px;
  padding: 6px;
  border-radius: 4px;
  text-align: center;
  transition: transform 0.1s, background 0.1s;
}
.emoji-item:hover { background: #f0f0f0; transform: scale(1.2); }
/* Comment Editor & Markdown Styles */
.comment-editor-wrapper {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 12px;
    transition: all 0.2s;
}
.comment-editor-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,84,67,0.1);
}
.markdown-editor {
    min-height: 80px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
}
.markdown-editor:empty:before {
    content: attr(placeholder);
    color: #999;
    pointer-events: none;
}

/* Live Markdown Styles (Line-based) */
.md-line-h1 { font-size: 1.6em; font-weight: 700; line-height: 1.3; margin: 0.4em 0; color: #222; }
.md-line-h2 { font-size: 1.4em; font-weight: 600; line-height: 1.3; margin: 0.3em 0; color: #333; }
.md-line-h3 { font-size: 1.2em; font-weight: 600; line-height: 1.3; margin: 0.2em 0; color: #444; }
.md-line-quote { border-left: 3px solid #ddd; padding-left: 10px; color: #666; font-style: italic; background: #f9f9f9; }
.md-line-list { padding-left: 20px; position: relative; }
.md-line-list::before { content: "•"; position: absolute; left: 6px; color: var(--primary); }
.md-line-code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; background: #f6f8fa; padding: 2px 4px; border-radius: 4px; color: #24292e; display: block; }

/* Comment Tools */
.comment-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: #fcfcfc;
    border-radius: 0 0 8px 8px;
}
.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    color: #666;
    transition: all 0.2s;
}
.icon-btn:hover { background: #eee; color: #333; }
.clip-btn {
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 4px;
    color: #666;
}
.clip-btn:hover { background: #eee; color: #333; }
#commentSendBtn {
    margin-left: auto;
    padding: 6px 16px;
    font-size: 13px;
}

/* Emoji Picker */
.emoji-picker {
    position: fixed;
    width: 360px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}
.emoji-picker.hidden { display: none; }
.emoji-header {
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
.emoji-grid {
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
}
.emoji-item {
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    text-align: center;
    user-select: none;
}
.emoji-item:hover { background: #f0f0f0; transform: scale(1.1); }

/* Comments List Styles */
.comment-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.comment-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    justify-content: space-between;
}
.comment-del {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
}
.comment-del:hover { opacity: 1; }
.comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}
.comment-content p { margin: 4px 0; }
.comment-content h1, .comment-content h2, .comment-content h3 { margin: 8px 0 4px; }
.comment-content blockquote {
    border-left: 3px solid #ddd;
    margin: 4px 0;
    padding-left: 10px;
    color: #666;
}
.comment-content pre {
    background: #f6f8fa;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
}

/* Live Markdown Line Styles */
.md-line-h1 { 
    font-size: 1.6em !important; 
    font-weight: bold !important; 
    border-bottom: 1px solid #eee; 
    color: #333;
    line-height: 1.4;
    padding-bottom: 4px;
}
.md-line-h2 { 
    font-size: 1.4em !important; 
    font-weight: bold !important; 
    border-bottom: 1px solid #eee; 
    color: #333;
    line-height: 1.4;
    padding-bottom: 4px;
}
.md-line-h3 { 
    font-size: 1.2em !important; 
    font-weight: bold !important; 
    color: #333;
}
.md-line-quote { 
    border-left: 4px solid #ddd; 
    padding-left: 10px !important; 
    color: #666 !important; 
    background-color: #f9f9f9;
}
.md-line-list { 
    color: #24292e;
}
.md-line-code { 
    font-family: Consolas, monospace !important; 
    background: #f6f8fa; 
    color: #032f62;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Emoji Picker Fixes */
.emoji-picker {
    position: fixed !important;
    width: 360px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 10000 !important;
    display: flex;
    flex-direction: column;
}

.emoji-grid {
    padding: 10px 12px 12px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    justify-items: center;
    align-items: center;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    text-align: center;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    min-width: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.emoji-item:hover {
    background-color: #f0f0f0;
}

/* --- Enhanced Comment Editor & Emoji Picker Styles --- */

/* Wrapper */
.comment-editor-wrapper {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 12px;
}

/* Contenteditable Editor */
.markdown-editor {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap; /* Maintain whitespace */
}

.markdown-editor:empty:before {
    content: attr(placeholder);
    color: #aaa;
    pointer-events: none;
    display: block; /* Ensure it shows */
}

/* Live Markdown Line Styles - Enforced */
.md-line-h1 { 
    font-size: 1.6em !important; 
    font-weight: bold !important; 
    border-bottom: 1px solid #eee; 
    color: #333;
    line-height: 1.4;
    padding-bottom: 4px;
    margin: 8px 0;
}
.md-line-h2 { 
    font-size: 1.4em !important; 
    font-weight: bold !important; 
    border-bottom: 1px solid #eee; 
    color: #333;
    line-height: 1.4;
    padding-bottom: 4px;
    margin: 6px 0;
}
.md-line-h3 { 
    font-size: 1.2em !important; 
    font-weight: bold !important; 
    color: #333;
    margin: 4px 0;
}
.md-line-quote {
    border-left: 4px solid #ddd !important;
    padding-left: 10px !important;
    color: #666 !important;
    font-style: italic;
    background: #f9f9f9;
}
.md-line-list {
    padding-left: 20px !important;
    position: relative;
}
.md-line-code {
    font-family: monospace !important;
    background: #f4f4f4 !important;
    padding: 2px 4px !important;
    border-radius: 4px;
    color: #d63384;
}

/* Tools Bar */
.comment-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #eee;
    background: #fafafa;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Emoji Picker - Fixed Positioning */
.emoji-picker {
    position: fixed !important; /* Use fixed to escape container clipping */
    width: 300px;
    height: 360px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 10000 !important;
    display: flex;
    flex-direction: column;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    padding: 8px 10px 10px;
    overflow-y: auto;
    flex: 1;
}

.emoji-item {
    cursor: pointer;
    font-size: 22px;
    text-align: center;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.1s;
}

.emoji-item:hover {
    background: #f0f0f0;
}

.emoji-search { padding: 8px 10px; border-bottom: 1px solid #eee; }
.emoji-search input { width: 100%; border: 1px solid #ddd; border-radius: 6px; padding: 6px 8px; outline: none; font-size: 13px; }

/* Attachment Preview */
.attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px 8px;
}

.attach-file {
    font-size: 12px;
    background: #eef;
    color: #44a;
    padding: 2px 6px;
    border-radius: 4px;
}
