* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #0d1117; color: #e6edf3; height: 100vh; overflow: hidden; }

#desktop { display: flex; flex-direction: column; height: 100vh; }

#topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #161b22; border-bottom: 1px solid #30363d; }
.logo { font-weight: 700; font-size: 15px; }
.spacer { flex: 1; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: #1f6feb22; color: #58a6ff; border: 1px solid #1f6feb55; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#main { display: grid; grid-template-columns: minmax(300px, 1fr) 2fr; flex: 1; overflow: hidden; }
#files-panel { display: flex; flex-direction: column; border-right: 1px solid #30363d; overflow: hidden; }
#chat-panel { display: flex; flex-direction: column; overflow: hidden; }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #30363d; }
.panel-head h2 { font-size: 14px; }
.upload-btn { cursor: pointer; font-size: 13px; color: #58a6ff; }

.search-box { padding: 10px 16px; border-bottom: 1px solid #30363d; }
.search-box input { width: 100%; padding: 7px 12px; border-radius: 6px; border: 1px solid #30363d; background: #0d1117; color: inherit; font-size: 13px; }

#file-list { flex: 1; overflow-y: auto; list-style: none; padding: 6px; }
#file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
#file-list li:hover { background: #21262d; }
#file-list .ficon { font-size: 16px; }
#file-list .fname { flex: 1; cursor: pointer; color: #e6edf3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#file-list .fname:hover { color: #58a6ff; }
#file-list .fsize { color: #8b949e; font-size: 12px; }
#file-list .fdel { cursor: pointer; color: #8b949e; font-size: 14px; padding: 0 4px; }
#file-list .fdel:hover { color: #f85149; }

.empty-state { color: #8b949e; font-size: 13px; text-align: center; padding: 30px 16px; }

#messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: #1f6feb; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #21262d; border-bottom-left-radius: 4px; }
.msg.error { align-self: flex-start; background: #3d1d1d; color: #ffa198; }

#chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #30363d; }
#chat-input { flex: 1; padding: 9px 13px; border-radius: 8px; border: 1px solid #30363d; background: #0d1117; color: inherit; font-size: 14px; }
#chat-input:focus { outline: none; border-color: #58a6ff; }

button { padding: 8px 16px; border-radius: 8px; border: none; background: #238636; color: #fff; cursor: pointer; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.ghost-btn { background: #21262d; border: 1px solid #30363d; color: #e6edf3; }
.ghost-btn:hover { background: #30363d; }
.danger-btn { background: #da3633; }
.danger-btn:hover { background: #f85149; }
.hidden { display: none !important; }

dialog { border: 1px solid #30363d; border-radius: 12px; background: #161b22; color: inherit; padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-body { padding: 24px; min-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h3 { margin: 0; font-size: 16px; }

#provider-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.provider-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #30363d; border-radius: 8px; cursor: pointer; }
.provider-item:hover { background: #21262d; }
.provider-item .p-info { flex: 1; min-width: 0; }
.provider-item .p-name { font-size: 14px; }
.provider-item .p-models { font-size: 12px; color: #8b949e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-item .p-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #238636; }
.provider-item.selected { border-color: #58a6ff; }

#provider-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
#provider-form input { padding: 7px 10px; border-radius: 6px; border: 1px solid #30363d; background: #0d1117; color: inherit; font-size: 13px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }