:root {
    --bg-color: #f4f6f9;
    --text-main: #1e293b;
    --border-color: #cbd5e1;
    --primary: #2563eb;
    --surface: #ffffff;
}

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-color); color: var(--text-main); font-size: 13px; }

.compact-container { margin: 20px auto; padding: 20px 30px; width: 98%; max-width: 1800px; background: var(--surface); border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); box-sizing: border-box; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 2px solid #e2e8f0; }
.page-title { margin: 0; font-size: 20px; font-weight: 600; display: flex; align-items: center; }
.stats { display: flex; gap: 10px; margin-top: 8px; }
.stat-box { background: #f8fafc; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border-color); font-size: 12px; font-weight: 500; }

.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.controls { display: flex; gap: 10px; }
.inline-action-box { display: flex; gap: 8px; background: #f8fafc; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; width: 100%; justify-content: flex-end; }

.form-control { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 4px; font-size: 13px; outline: none; transition: 0.2s; min-width: 150px; }
.form-control:focus { border-color: var(--primary); }

.btn { padding: 6px 12px; border-radius: 4px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-sm { padding: 5px 8px; font-size: 12px; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #475569; color: white; }
.btn-success { background: #16a34a; color: white; }
.btn-light { background: #f1f5f9; border: 1px solid #cbd5e1; }
.btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.btn-light:hover { background: #e2e8f0; }
.btn-danger:hover { background: #fecaca; }

/* Sticky Global Header */
.global-grid-header { 
    display: grid; 
    grid-template-columns: 1fr 1.5fr 1fr 2fr 2fr 1.2fr 60px; 
    gap: 15px; 
    padding: 14px 15px; 
    background: #ffffff; 
    font-weight: 600; 
    color: #475569; 
    font-size: 13px; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    border: 1px solid var(--border-color); 
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.count-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 12px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.section { border: 1px solid var(--border-color); border-radius: 6px; margin-bottom: 20px; }
.section-header { padding: 12px 15px; background: #f8fafc; display: flex; justify-content: space-between; align-items: center; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.section-title { font-weight: 600; font-size: 16px; width: 50%; display: flex; align-items: center; gap: 8px;}
.section-title i { color: var(--text-muted); font-size: 14px; }
.section-title input { font-size: 16px; font-weight: 600; border: none; background: transparent; border-bottom: 1px solid var(--primary); outline: none; width: 100%; }

/* Grid aligns perfectly with the global header */
.api-row { display: grid; grid-template-columns: 1fr 1.5fr 1fr 2fr 2fr 1.2fr 60px; gap: 15px; padding: 12px 15px; border-bottom: 1px solid #e2e8f0; align-items: start; transition: background 0.1s; }
.api-row:hover { background: #fbfbfb; }

.multiline-text { white-space: pre-wrap; word-break: break-word; font-family: monospace; font-size: 12px; line-height: 1.5; min-height: 20px; cursor: text; border: 1px solid transparent; padding: 2px 4px; }
.api-row:not(.editing) .multiline-text:hover { background: #f1f5f9; border-radius: 4px; border: 1px dashed var(--border-color); }

.edit-textarea { width: 100%; box-sizing: border-box; padding: 6px; border: 1px solid var(--primary); border-radius: 4px; resize: vertical; min-height: 60px; font-family: monospace; font-size: 12px; line-height: 1.4; outline: none; background: #fff; }

/* Native Dropdowns for Status AND Assignee */
.live-dropdown { padding: 4px; border-radius: 4px; font-size: 11px; font-weight: 600; border: 1px solid #cbd5e1; outline: none; cursor: pointer; width: 100%; margin-bottom: 6px; background: #fff;}
.status-Requested { background: #f1f5f9; color: #475569; }
.status-Created { background: #e0f2fe; color: #0284c7; border-color: #bae6fd; }
.status-Implemented { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.status-Fix { background: #fef9c3; color: #ca8a04; border-color: #fde047; }
.status-Bug { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.status-Improve { background: #f3e8ff; color: #9333ea; border-color: #d8b4fe; }

.add-api { padding: 12px; cursor: pointer; color: var(--text-muted); font-weight: 600; text-align: center; background: #f8fafc; font-size: 13px; transition: 0.2s; border-radius: 0 0 6px 6px; }
.add-api:hover { background: #f1f5f9; color: var(--primary); }

/* Dynamic Status Colors */
.status-Requested { background: #f1f5f9; color: #475569; }
.status-APICreated { background: #e0f2fe; color: #0284c7; }
.status-RequestImplementation { background: #fef08a; color: #854d0e; }
.status-Implemented { background: #dcfce7; color: #16a34a; }
.status-Reopen { background: #ffedd5; color: #c2410c; }
.status-NeedFix { background: #fee2e2; color: #dc2626; }

/* Chat Interface Styles */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-box { background: #f8fafc; width: 450px; max-width: 90%; border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); overflow: hidden; display: flex; flex-direction: column; max-height: 80vh; }
.modal-header { padding: 15px 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: #ffffff; }
.modal-body { padding: 20px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 15px 20px; border-top: 1px solid #e2e8f0; background: #ffffff; }

/* Chat Bubbles */
.chat-row { display: flex; flex-direction: column; max-width: 85%; }
.chat-me { align-self: flex-end; align-items: flex-end; }
.chat-them { align-self: flex-start; align-items: flex-start; }

.chat-author { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 4px; padding: 0 4px; }
.chat-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* My messages are Blue */
.chat-me .chat-bubble { background: #2563eb; color: #ffffff; border-bottom-right-radius: 4px; }
/* Their messages are White/Gray */
.chat-them .chat-bubble { background: #ffffff; color: #1e293b; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }

.chat-date { font-size: 10px; color: #94a3b8; margin-top: 4px; padding: 0 4px; }
.chat-me .chat-date { color: #cbd5e1; } /* Lighter date text for blue bubbles */