  /* ===== GEAR / SETTINGS DRAWER ===== */
  .gear-btn, .knowledge-btn {
    background: transparent;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: var(--ink-faded);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }
  .gear-btn:hover, .knowledge-btn:hover { color: var(--ink); background: var(--paper-dark); }
  .gear-btn:active, .knowledge-btn:active { background: var(--line-soft); color: var(--ink); }
  .knowledge-btn svg { transform: translate(7px, 1px); }
  /* ===== BAZA WIEDZY ===== */
  .kb-result-row {
    width: 100%; text-align: left; background: none; border: none;
    border-bottom: 1px solid var(--line); padding: 10px 6px;
    cursor: pointer; display: flex; align-items: center; gap: 10px;
    font-family: 'Inter Tight', sans-serif; border-radius: 0;
    transition: background .12s;
  }
  .kb-result-row:last-child { border-bottom: none; }
  .kb-result-row:hover { background: var(--paper) !important; }
  .kb-result-row:active { background: var(--line-soft) !important; }
  .kb-back-btn {
    background: none; border: none; cursor: pointer; padding: 0 0 14px;
    display: flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 600; font-family: 'Inter Tight', sans-serif;
    color: var(--accent); letter-spacing: 0.01em;
  }
  .kb-back-btn:hover { opacity: 0.75; }
  .kb-acc-item { border-bottom: 1px solid var(--line); }
  .kb-acc-item:last-child { border-bottom: none; }
  .kb-acc-btn {
    width: 100%; text-align: left; background: none; border: none;
    padding: 11px 13px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    font-family: 'Inter Tight', sans-serif; transition: background .1s;
  }
  .kb-acc-btn:hover { background: var(--paper); }
  .kb-acc-body {
    padding: 0 13px 12px; font-size: 13px; line-height: 1.6;
    color: var(--ink); white-space: pre-wrap;
  }
  .kb-tile-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 9px; padding: 18px 12px 14px; border-radius: 14px; min-height: 88px;
    border: 1.5px solid var(--line); background: var(--paper);
    cursor: pointer; text-align: center; width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s, background 0.15s;
  }
  @media (hover: hover) {
    .kb-tile-btn:hover { background: var(--paper-dark); }
  }
  .kb-tile-btn:active { background: var(--paper-dark); transform: scale(0.97); }

  .kb-med-chip {
    background: var(--paper-dark); border: 1px solid var(--line);
    border-radius: 20px; padding: 5px 12px;
    font-size: 13px; font-family: 'Inter Tight', sans-serif;
    color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s;
    white-space: nowrap;
  }
  .kb-med-chip:hover { background: var(--line-soft); border-color: var(--ink-faded); }
  .kb-card-btn {
    background: none; border: none; cursor: pointer;
    font-size: 17px; line-height: 1; padding: 4px;
    border-radius: 6px; transition: background .12s; flex-shrink: 0;
    opacity: 0.55;
  }
  .kb-card-btn:hover { background: var(--line-soft); opacity: 1; }
  .kb-close-btn {
    width: 100%; padding: 13px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--paper-dark);
    color: var(--ink); font-size: 15px; font-weight: 400;
    font-family: 'Inter Tight', sans-serif; cursor: pointer;
    transition: background .12s;
  }
  .kb-close-btn:hover { background: var(--line-soft); }
  .kb-close-btn:active { background: var(--line); }
  #kb-view,
  .modal,
  .settings-drawer,
  .cal-tg-scroll,
  .ai-mini-response,
  .plan-preview { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  #kb-view::-webkit-scrollbar,
  .modal::-webkit-scrollbar,
  .settings-drawer::-webkit-scrollbar,
  .cal-tg-scroll::-webkit-scrollbar,
  .ai-mini-response::-webkit-scrollbar,
  .plan-preview::-webkit-scrollbar { width: 2px; }
  #kb-view::-webkit-scrollbar-track,
  .modal::-webkit-scrollbar-track,
  .settings-drawer::-webkit-scrollbar-track,
  .cal-tg-scroll::-webkit-scrollbar-track,
  .ai-mini-response::-webkit-scrollbar-track,
  .plan-preview::-webkit-scrollbar-track { background: transparent; }
  #kb-view::-webkit-scrollbar-thumb,
  .modal::-webkit-scrollbar-thumb,
  .settings-drawer::-webkit-scrollbar-thumb,
  .cal-tg-scroll::-webkit-scrollbar-thumb,
  .ai-mini-response::-webkit-scrollbar-thumb,
  .plan-preview::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
  .settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31,42,58,0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
  }
  .settings-overlay.open { opacity: 1; pointer-events: auto; }
  .settings-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(300px, 88vw);
    background: var(--paper);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.32,0,0.16,1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(31,42,58,0.14);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .settings-overlay.open .settings-drawer { transform: translateX(0); }
  .settings-header {
    padding: 20px 18px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }
  .settings-title {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
  }
  .settings-close {
    background: transparent;
    border: none;
    color: var(--ink-faded);
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
  }
  .settings-close:active { background: var(--paper-dark); }
