/* HISTORY */
  .history-item {
    border-right: 4px solid var(--blue);
    background: #fdfdfd;
    padding: 16px;
    margin-bottom: 13px;
    border-radius: 4px 13px 13px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
    border: 1px solid #f0f0f0;
  }

  .history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--light);
    margin-bottom: 7px;
  }

  .history-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.65;
  }

  /* WALLET */
  .wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .wallet-row:last-child {
    border-bottom: none;
  }

  .w-amount {
    font-weight: 700;
    color: #059669;
    font-size: 14px;
    background: #ecfdf5;
    padding: 3px 8px;
    border-radius: 6px;
  }

  /* QUILL */
  .quill-wrapper {
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, .52);
  }

  .quill-wrapper .ql-toolbar {
    background: rgba(255, 255, 255, .85);
    border: none;
    border-bottom: 1px solid rgba(0, 168, 132, .14);
    padding: 7px;
    direction: ltr;
  }

  .quill-wrapper .ql-container {
    border: none;
    font-family: 'Cairo';
    font-size: 13px;
    background: rgba(255, 255, 255, .5);
    border-radius: 0 0 10px 10px;
    min-height: 160px;
  }

  .quill-wrapper .ql-editor {
    min-height: 160px;
    padding: 13px;
    line-height: 1.8;
    color: #334155;
    text-align: right;
    direction: rtl;
  }

  .quill-wrapper .ql-editor.ql-blank::before {
    right: 13px;
    left: auto;
    font-style: normal;
    color: #a0aec0;
    font-family: 'Cairo';
    font-size: 13px;
  }

  .quill-wrapper .ql-editor ol,
  .quill-wrapper .ql-editor ul {
    padding-right: 2.5em !important;
    padding-left: 0 !important;
  }

  .quill-wrapper .ql-editor li {
    text-align: right !important;
    direction: rtl !important;
    padding-right: 0 !important;
    margin-bottom: 6px !important;
  }

  .quill-wrapper .ql-editor li::before {
    right: -2.5em !important;
    left: auto !important;
    text-align: right !important;
    width: 2em !important;
  }

  .quill-wrapper:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, .1);
  }

  /* GEMINI BAR */
  .gemini-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .gemini-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 9px;
    padding: 7px 12px;
    font-family: 'Cairo';
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .25s;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .gemini-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
  }

  .gemini-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
  }

  .gemini-btn-format {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
  }

  .gemini-btn-rewrite {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
  }

  .gemini-btn-summarize {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
  }

  #gemini-loading {
    display: none;
    align-items: center;
    gap: 9px;
    background: linear-gradient(135deg, rgba(0, 80, 130, .05), rgba(0, 168, 132, .05));
    border: 1px solid rgba(0, 168, 132, .2);
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 12px;
    color: var(--blue);
    font-weight: 600;
  }


  /* RISK BANNER */
  .risk-banner {
    background: linear-gradient(135deg, #fff1f2, #fecdd3);
    border: 1.5px solid #fca5a5;
    border-radius: 11px;
    padding: 11px 14px;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 700;
    color: #9b2c2c;
    margin-bottom: 10px;
    display: none;
  }

  .risk-banner.show {
    display: flex;
  }

  /* TREATMENT PLAN */
  .plan-save-btn,
  .plan-add-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 11px;
    font-family: 'Cairo';
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .plan-save-btn {
    background: var(--teal);
    color: #fff;
  }

  .plan-add-btn {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
  }

  .plan-save-btn:hover,
  .plan-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .1);
  }

  .goal-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: 4px solid var(--teal);
    border-radius: 4px 12px 12px 4px;
    padding: 14px;
    margin-bottom: 10px;
  }

  .goal-card .goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 9px;
  }

  .goal-title-input {
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    border: none;
    background: transparent;
    width: calc(100% - 150px);
    font-family: 'Cairo';
    padding: 0;
  }

  .goal-title-input:focus {
    outline: none;
    border-bottom: 1px dashed var(--teal);
  }

  .objective-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .objective-item:last-child {
    border-bottom: none;
  }

  .objective-check {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    border: 2px solid #cbd5e0;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all .2s;
    background: #fff;
  }

  .objective-check.done {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
  }

  .iv-pill {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 3px;
  }

  .iv-pill button {
    background: none;
    border: none;
    color: #a78bfa;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
  }

  .iv-preset-btn {
    font-family: 'Cairo';
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .2s;
    margin: 3px;
  }

  /* CLINICAL AI PANEL */
  .clinical-panel {
    display: none;
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 14px 14px 34px;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.8;
    color: #334155;
    text-align: right;
    position: relative;
  }
  
  /* SPEECH TO TEXT DICTATION WIDGET */
  .dictation-wrapper {
    margin-top: 15px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px dashed rgba(13, 148, 136, 0.3);
    border-radius: 16px;
    transition: all 0.3s ease;
  }

  .dictation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .dictation-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .dictation-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .dictation-status-text {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
  }

  .dictation-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.3s ease;
  }

  .dictation-indicator.active {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
  }

  .dictation-controls {
    display: flex;
    gap: 12px;
    align-items: stretch;
  }

  .dictation-mic-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #475569;
    transition: all 0.3s ease;
    flex-shrink: 0;
  }

  .dictation-mic-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
  }

  .dictation-mic-btn.active {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
    animation: dictation-pulse 1.5s infinite;
  }

  .dictation-textarea-container {
    position: relative;
    flex: 1;
  }

  .dictation-textarea {
    height: 50px;
    font-size: 12px;
    line-height: 1.6;
    padding: 10px 12px;
    resize: none;
    direction: rtl;
    text-align: right;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    font-family: 'Cairo';
    width: 100%;
    transition: all 0.3s;
  }

  .dictation-textarea:focus {
    border-color: var(--teal);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
    outline: none;
  }

  .dictation-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
  }

  .dictation-btn-sm {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 22px;
    font-family: 'Cairo';
    border: none;
  }

  .dictation-btn-insert {
    background: var(--blue);
    color: white;
  }

  .dictation-btn-insert:hover {
    background: #1d4ed8;
  }

  .dictation-btn-clear {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
  }

  .dictation-btn-clear:hover {
    background: #e2e8f0;
    color: #1e293b;
  }

  .dictation-error-banner {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 8px;
    direction: rtl;
    text-align: right;
  }

  @keyframes dictation-pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    70% {
      box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
  }