:root {
    --bg: #fff;
    --text: #111;
    --link: #0066cc;
    --table-border: #ccc;
  }
  
  .dark-mode {
    --bg: #111;
    --text: #eee;
    --link: #66aaff;
    --table-border: #444;
  }
  
  body {
    margin: 0;
    padding: 2rem;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
  }
  
  main {
    max-width: 800px;
    margin: auto;
  }
  
  a {
    color: var(--link);
    text-decoration: underline;
  }
  
  table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    border: none;
    border-radius: 0; /* remove rounded corners */
    overflow: visible;
    box-shadow: none;
  }
  
  thead {
    background-color: transparent;
    border-bottom: none;
  }
  
  th, td {
    text-align: left;
    padding: 1rem;
    vertical-align: top;
    border: none;
  }
  
  tbody tr:hover {
    background-color: transparent;
  }
  
  th {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
  }
  
  td a {
    color: var(--link);
    text-decoration: underline;
    font-weight: 500;
  }
  
  input[type="text"] {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--table-border);
    background-color: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    width: 250px;
  }
  
  @media screen and (max-width: 768px) {
    table, thead, tbody, th, td, tr {
      display: block;
    }
  
    thead {
      display: none;
    }
  
    tr {
      margin-bottom: 1rem;
      padding: 1rem;
      border: none;
      border-radius: 0;
      background: transparent;
    }
  
    td {
      display: flex;
      justify-content: space-between;
      padding: 0.5rem 0;
      border: none;
    }
  
    td::before {
      content: attr(data-label);
      font-weight: 600;
      flex-basis: 45%;
    }
  }
      
  .toggle-btn {
    background: none;
    border: 1px solid var(--text);
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 0.9rem;
  }

  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .toggle-icon {
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.3rem 0.6rem;
    user-select: none;
  }
    
  /* Chat styles */
  .chat-box {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 320px;
    border-radius: 12px;
    padding: 1rem;
    font-family: system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    border: 1px solid var(--table-border);
    z-index: 1000;
  }

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

  .chat-title {
    margin: 0;
    font-size: 1rem;
  }

  .chat-toggle-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
  }

  .chat-body {
    padding: 1rem;
  }
  
  .chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: var(--bg);
    border: 1px solid var(--table-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  .chat-form {
    margin: 0;
  }
  
  .chat-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--table-border);
    border-radius: 8px;
    background-color: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
  }
    
  .bubble {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 15px;
    line-height: 1.4;
    word-wrap: break-word;
  }

  .user-bubble {
    align-self: flex-end;
    background-color: var(--link);
    color: white;
  }

  .llm-bubble {
    align-self: flex-start;
    background-color: var(--table-border);
    color: var(--text);
  }

/* This keeps the loading bubble consistent with LLM bubbles */
.llm-bubble.typing {
  display: flex;
  align-items: center;
  justify-content: start;
  height: 1.5rem; /* Match height to text bubble */
  background-color: var(--table-border);
  color: var(--text);
}

/* Adjust dot size and animation */
.dot-typing {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 4px;
}

.dot-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  animation: blink 1s infinite alternate;
}

.dot-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.dot-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}
