  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f5f7;
    color: #1c1e21;
  }
  .hidden { display: none !important; }

  #login-screen {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
  }
  #login-screen h1 { font-size: 18px; margin-top: 0; }
  #login-screen input {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
  }
  #login-screen button {
    width: 100%;
    padding: 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
  }
  #login-error { color: #c0392b; font-size: 13px; margin-top: 8px; min-height: 16px; }

  #app-screen {
    display: flex;
    height: 100vh;
  }
  #sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e2e2e2;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
  }
  #sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #e2e2e2;
  }
  #new-chat-btn {
    width: 100%;
    padding: 8px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
  }
  #chat-list { flex: 1; overflow-y: auto; }
  .chat-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
  }
  .chat-item:hover { background: #f4f5f7; }
  .chat-item.active { background: #e8efff; }
  #logout-btn {
    margin: 12px;
    padding: 6px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
  }

  #chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  #message-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
  }
  .msg { margin-bottom: 16px; max-width: 720px; }
  .msg-user { margin-left: auto; text-align: right; }
  .msg-bubble {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    text-align: left;
  }
  .msg-user .msg-bubble { background: #2563eb; color: #fff; }
  .msg-assistant .msg-bubble { background: #fff; border: 1px solid #e2e2e2; }
  .msg-status { font-size: 13px; color: #888; font-style: italic; padding: 4px 0; }

  .sources { margin-top: 8px; font-size: 13px; }
  .source-item {
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fafafa;
  }
  .source-summary {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .source-summary:hover { background: #f0f0f0; }
  .source-detail {
    padding: 10px;
    border-top: 1px solid #e2e2e2;
    font-size: 13px;
    line-height: 1.5;
  }
  .source-detail a { color: #2563eb; }
  .source-detail .header { font-weight: 600; margin-bottom: 6px; }

  .warnings { margin-top: 8px; }
  .warning-item {
    font-size: 13px;
    color: #92400e;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 4px;
  }

  #input-bar {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e2e2e2;
    background: #fff;
  }
  #question-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    resize: none;
  }
  #send-btn {
    margin-left: 8px;
    padding: 0 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
  }
  #send-btn:disabled { background: #a5b4d8; cursor: default; }
  #empty-state { color: #999; text-align: center; margin-top: 40px; font-size: 14px; }
