   html,
   body {
     margin: 0;
     padding: 0;
     height: 100%;
     overflow: hidden;
     font-family: sans-serif;
   }

   .topbar {
     height: 40px;
     background: #333;
     color: white;
     display: flex;
     align-items: center;
     padding: 0 10px;
     box-sizing: border-box;
     position: relative;
     z-index: 2;
   }

   .hamburger {
     cursor: pointer;
     margin-right: 20px;
   }

   .menu {
     display: none;
     position: fixed;
     top: 40px;
     left: 0;
     min-width: 200px;
     height: calc(100% - 40px);
     background: #444;
     color: white;
     padding: 20px;
     box-sizing: border-box;
     z-index: 1;
   }

   #menu .menu-item {
     position: relative;
     padding: 6px 12px;
     cursor: pointer;
     font-weight: 500;
     color: #333;
     user-select: none;
     background: #707070;
     border-radius: 1px;
     margin-bottom: 2px;
   }

   #menu * {
     color: black;
     text-decoration: none;
   }


   #menu .menu-item:hover {
     background: #e0e0e0;
   }

   #menu .has-submenu:hover .submenu {
     display: block;
   }

   #menu .submenu {
     display: none;
     position: absolute;
     top: 100%;
     left: 0;
     background: white;
     border: 1px solid #ccc;
     border-radius: 1px;
     min-width: 140px;
     z-index: 1000;
   }

   #menu .submenu-item {
     padding: 6px 12px;
     cursor: pointer;
   }

   #menu .submenu-item:hover {
     background: #f0f0f0;
   }

   .container {
     display: flex;
     height: calc(100% - 40px);
     width: 100%;
     position: relative;
   }

   .left-panel {
     width: 300px;
     min-width: 150px;
     max-width: 600px;
     display: flex;
     flex-direction: column;
     overflow: hidden;
     box-sizing: border-box;
     flex-shrink: 0;
     flex-grow: 0;
   }

   .resizer {
     width: 3px;
     min-width: 3px;
     overflow: hidden;
     cursor: col-resize;
     background: #ccc;
     height: 100%;
     z-index: 1;
   }

   .inline-inputs {
     display: flex;
     gap: 8px;
   }

   .inline-inputs input {
     flex: 1;
   }

   .inline-toggle {
     font-size: 0.85em;
     color: #666;
     margin-top: 4px;
   }

   .left-panel .list {
     width: 100%;
     overflow: auto;
     overflow-x: hidden;
     flex: 1;
     padding: 10px;
     box-sizing: border-box;

     display: flex;
     flex-direction: column;
     gap: 1px;
   }

   .left-panel .list>div {
     white-space: nowrap;
     flex-shrink: 0;

   }

   .list-item {
     padding: 6px 10px;
     border-radius: 4px;
     transition: background 0.2s;
     cursor: pointer;
   }

   .list-item .selected:not(.tree-node) {
     background: black;
     color: white;
   }

   .list-item.selected>.tree-header {
     background: black;
     color: white;
   }

   .right-panel {
     display: flex;
     flex-direction: column;
     flex-grow: 1;
     overflow: hidden;
   }

   .filters,
   .content-header {
     background: #eee;
     padding: 10px;
     flex-shrink: 0;
     height: auto;
     font-weight: bold;
     border-bottom: 1px solid #ccc;
     box-sizing: border-box;
     font-size: 1em;
     line-height: 1.2em;
   }

   .content-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     /* align vertically in the same line */
   }

   .nav-buttons {
     display: flex;
     gap: 5px;
   }

   .nav-button {
     background: none;
     border: none;
     font-size: 1em;
     /* match text size */
     line-height: 1em;
     padding: 2px 6px;
     color: grey;
     cursor: default;
     height: 100%;
     /* fill parent height, without affecting layout */
     box-sizing: border-box;
   }

   .nav-button.enabled {
     color: black;
     cursor: pointer;
   }

   .content-row {
     display: flex;
     flex-direction: row;
     flex: 1 1 auto;
     min-width: 0;
     min-height: 0;
   }

   .content-row .content {
     flex: 1 1 0;
     min-width: 0;
     transition: width 0.2s;
     /* Optional: smooth resizing */
     overflow-y: auto;
     padding: 10px;
     box-sizing: border-box;
   }

   #recommendation-panel,
   .recommendation-panel {
     flex: 0 0 450px;
     max-width: 450px;
     min-width: 400px;
     background: #f8f8fc;
     border-left: 1px solid #ddd;
     padding: 1em;
     box-sizing: border-box;
     overflow-y: auto;
     transition: opacity 0.2s, max-width 0.2s;
     /* Optional: add drop shadow, etc. */
     box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
     display: none;
   }

   .filters .filters-body {
     display: none;
     padding: 10px 4px;
     border: 1px solid #ddd;
     background: #fafafa;
     margin-top: 10px;
   }

   #filters-toggle:checked~.filters-body {
     display: block;
   }

  .filters-toggle::after {
     content: " ▲";
   }

   #filters-toggle:checked+.filters-toggle::after {
     content: " ▼";
   }

   #loading-overlay {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     z-index: 9999;
     display: flex;
     align-items: center;
     justify-content: center;
     pointer-events: all;
   }

   #loading-overlay.hidden {
     display: none;
   }

   .spinner {
     border: 4px solid #ccc;
     border-top: 4px solid #333;
     border-radius: 50%;
     width: 36px;
     height: 36px;
     animation: spin 1s linear infinite;
   }

   @keyframes spin {
     to {
       transform: rotate(360deg);
     }
   }

   /* --- Status indicator spinner (background task) --- */
   .status-indicator {
     position: absolute;
     right: 10px;
     /* align right in topbar */
     top: 50%;
     transform: translateY(-50%);
     display: flex;
     align-items: center;
     gap: 6px;
     color: #ddd;
     pointer-events: none;
     /* so hover only on icon itself */
     z-index: 10;
   }

   .status-indicator svg {
     width: 18px;
     height: 18px;
     display: none;
     /* hidden unless active */
     animation: spin 0.9s linear infinite;
     z-index: 11;
   }

   .status-indicator.active svg {
     display: block;
     z-index: 11;
   }


   .api-key-modal .modal-content {
     box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
   }

   .badge {
     padding: 2px 8px;
     border-radius: 999px;
     font-size: 12px;
   }

   .badge-read {
     background: #e6f0ff;
     color: #214c9a;
   }

   .badge-recommend {
     background: #fff4e5;
     color: #9a5a21;
   }

   .badge-write {
     background: #e8fff1;
     color: #1c7c3a;
   }

   .is-disabled {
     opacity: .5;
     pointer-events: none;
   }

   /* --- Appmessage styles --- */
   #messages-container {
     left: 0;
     right: 0;
     width: 100%;
     display: flex;
     flex-direction: column;
     box-sizing: border-box;
   }

   .message-item {
     border-radius: 8px;
     padding: 10px 40px 10px 12px;
     background: #f3f4f6;
     border: 1px solid #e5e7eb;
     color: #111827;
     box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.08);
   }

   .message-item .message-content {
     font-size: 0.95rem;
     line-height: 1.3rem;
     white-space: pre-wrap;
   }

   .message-close {
     top: 4px;
     right: 6px;
     width: 28px;
     height: 28px;
     border: 1px solid #6b7280;
     background: transparent;
     font-size: 20px;
     line-height: 20px;
     cursor: pointer;
     color: #6b7280;
     float: right;
   }

   .message-close:hover {
     color: #111827;
   }

   /* Severity variants */
   .message-item.severity-info {
     background: #eff6ff;
     border-color: #bfdbfe;
     color: #1e3a8a;
   }

   .message-item.severity-warning {
     background: #fffbeb;
     border-color: #fde68a;
     color: #92400e;
   }

   .message-item.severity-error {
     background: #fef2f2;
     border-color: #fecaca;
     color: #7f1d1d;
   }

   .message-item.severity-success {
     background: #ecfdf5;
     border-color: #bbf7d0;
     color: #064e3b;
   }