/* assets/receitas.css */

/* ============================================================
   1. LAYOUT & TOOLBAR (Barra Superior)
   ============================================================ */
.receitas-toolbar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--tab-inactive);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 -2px 5px rgba(0,0,0,0.03);
}

.receitas-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

/* ============================================================
   2. INPUT DE BUSCA
   ============================================================ */
.search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-receitas {
    width: 100%;
    max-width: 350px;
    padding: 10px 95px 10px 36px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s ease;
    background-color: var(--input-bg); /* Fundo do input adaptável */
    color: var(--text-main);           /* Texto do input adaptável */
}

/* Wrapper com ícone de lupa */
.search-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    color: #888;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1;
}
.search-input-wrapper .search-receitas { width: 100%; }
.search-receitas:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1); /* Opcional: ajustar a cor da sombra via variável se quiser */
}

.no-results-msg {
    font-size: 0.85rem;
    color: var(--danger-color); /* Usa vermelho do tema */
    font-weight: 600;
    display: none;
    animation: fadeIn 0.3s ease;
    white-space: nowrap;
}

/* ============================================================
   3. BOTÃO ADICIONAR (TEXTO FIXO)
   ============================================================ */
.btn-add-receita {
    background: var(--success-color);
    border: none;
    border-radius: 30px;
    height: 40px;
    cursor: pointer;
    color: white; 
    
    display: flex;
    align-items: center;
    justify-content: center; /* Centraliza o conteúdo */
    
    padding: 28px 20px; /* Padding fixo e confortável */
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-add-receita span {
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 10px; /* Espaço fixo entre texto e ícone */
}

.btn-add-receita i { font-size: 1.1rem; }

.btn-add-receita:hover {
    background-color: #218838;
    transform: translateY(-1px); /* Leve feedback visual de elevação */
}
/* Legenda do FAB (mobile) escondida no desktop — re-exibida em cids.css */
.btn-add-receita .cid-add-legend { display: none; }


/* ============================================================
   4. LISTA DE ABAS (BOTÕES)
   ============================================================ */
.receitas-tabs-wrapper {
    width: 100%;
    max-height: 400px; /* Alterado conforme solicitado */
    overflow-y: auto;
    padding: 2px;
}

/* O container geral agora empilha as seções */
.receitas-tabs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Títulos e Blocos das categorias */
.receitas-categoria-section { display: flex; flex-direction: column; }

.receitas-categoria-titulo {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-main);
    opacity: 0.38;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.receitas-categoria-titulo::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.receitas-categoria-wrapper {
    position: relative;
    width: 100%;
}

/* Trava a altura para mostrar cerca de 3 linhas antes do botão Mostrar Mais */
.receitas-categoria-wrapper.collapsed {
    max-height: 128px;
    overflow: hidden;
}

/* Lista usando CSS Grid — elimina stretch na última linha */
/* max(140px, calc((100%-32px)/5)): garante exatamente máx 5 colunas em qualquer largura */
/* 32px = 4 gaps de 8px; mobile cai para 140px mínimo → 2 colunas em ~360px */
.receitas-categoria-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(140px, calc((100% - 32px) / 5)), 1fr));
    gap: 8px;
    min-height: 34px;
}

/* O Efeito de Degradê */
.receitas-fade-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55px;
    background: linear-gradient(to bottom, transparent, var(--tab-inactive));
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
    z-index: 10;
    pointer-events: none; /* <-- DEIXA O MOUSE ATRAVESSAR O DEGRADÊ */
}

.btn-show-more, .btn-show-less {
    pointer-events: auto;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 5px 25px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    margin-top: 5px;
    margin-bottom: 5px;
}
.btn-show-more:hover, .btn-show-less:hover {
    background: var(--accent-hover);
}

/* --- MOBILE: Torna a lista em coluna única durante o arraste --- */
.mobile-vertical-sort {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
}

.mobile-vertical-sort .receita-tab-item {
    width: 100% !important;
    margin-bottom: 0 !important; 
    padding: 6px 12px !important; /* Deixa a aba mais fina */
    min-height: 32px; 
    justify-content: space-between;
}

/* No mobile, expande a altura máxima e garante mínimo de 2 colunas por linha */
@media (max-width: 900px) {
    .receitas-tabs-wrapper {
        max-height: 65vh !important; /* Ocupa até 65% da altura da tela */
    }
    .receitas-categoria-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
.receita-tab-item {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    user-select: none;
    transition: 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    flex: 1 1 130px;
    max-width: 200px;
    min-height: 60px;
    padding: 8px 22px 8px 12px;
    position: relative;
}

.receita-tab-item:hover {
    background: var(--hover-row); /* Cor de hover adaptável */
    border-color: var(--border-color);
}

.receita-tab-item.active {
    background: var(--tab-active-bg);
    color: var(--tab-active-text);
    border-color: var(--tab-active-border);
    font-weight: 600;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}
.receita-tab-item.active i { color: rgba(255,255,255,0.9); }

/* "Adicione suas Receitas" — visual igual às outras abas, mas texto verde com + */
.receita-tab-item[data-is-fake="true"] {
    color: var(--accent-secondary);
    font-weight: 700;
}
.receita-tab-item[data-is-fake="true"]::before {
    content: "+ ";
    color: var(--accent-secondary);
    font-weight: 700;
}

/* Ícones padrão (inativos) */
.receita-tab-item i {
    margin-left: 6px;
    opacity: 0.7;
}

.sortable-chosen {
    background-color: #fff3cd !important; /* Amarelo/Dourado suave */
    color: #856404 !important;
    border: 1px solid #ffeeba !important;
    transform: scale(1.03); /* Dá uma leve aumentada para parecer que "descolou" da tela */
    box-shadow: 0 8px 15px rgba(0,0,0,0.15) !important;
    z-index: 100;
}

/* O "fantasma" ou espaço vazio que fica na lista enquanto você arrasta */
.sortable-ghost {
    opacity: 0.4 !important;
    background-color: transparent !important;
    border: 2px dashed var(--accent-color) !important; /* Borda tracejada indicando onde vai cair */
}


/* ============================================================
   5. WORKSPACE (EDITOR DE TEXTO)
   ============================================================ */
.receita-workspace {
    background: var(--bg-container);
    border: none;
    border-radius: 8px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.receita-header-info {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;
}

.receita-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-size-controls {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 2px;
}

/* Botão de favoritar no header do workspace (à esquerda dos botões de tamanho) */
.btn-fav-workspace {
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: #fbbf24;
    opacity: 0.45;
    font-size: 1rem;
    line-height: 1;
    transition: opacity .15s, transform .15s;
}
.btn-fav-workspace:hover { opacity: 1; transform: scale(1.1); }
.btn-fav-workspace.is-fav { opacity: 1; }

/* Mostra separador só quando SALVAR/RESETAR estiverem visíveis */
#status-save-receita:not(:empty) ~ .font-size-controls {
    border-left: 1px solid var(--border-color);
    padding-left: 10px;
}

.btn-font-size {
    background: none;
    border: none;
    padding: 2px 5px;
    cursor: pointer;
    color: var(--text-main);
    opacity: 0.3;
    line-height: 1;
    transition: opacity .15s, color .15s;
    font-family: 'Roboto Mono', monospace;
    font-weight: 400;
}
.btn-font-size:hover { opacity: 0.7; }
.btn-font-size.active {
    opacity: 0.7 !important;
    color: var(--accent-color);
    font-weight: 700;
}
/* Tamanhos visuais dos "A" — mostram a diferença entre os níveis */
#btn-font-sm span { font-size: 11px; }
#btn-font-md span { font-size: 14px; }
#btn-font-lg span { font-size: 17px; }
.receita-header-info h3 {
    margin: 0; 
    font-size: 1.2rem; 
    color: var(--heading-color);
    font-weight: 700;
}

.editor-receita {
    flex: 1; width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--input-bg);
    color: var(--text-main);
    transition: border 0.2s;
}
.editor-receita:focus {
    border-color: var(--accent-color); 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

#status-save-receita {
    display: flex; gap: 8px; align-items: center;
}
.btn-rec-top {
    padding: 6px 12px; border-radius: 8px; border: none; font-size: 0.75rem; 
    font-weight: 600;
    font-family: inherit; cursor: pointer; color: #fff; transition: 0.2s;
    display: flex; align-items: center; gap: 6px; 
}
.btn-rec-save { 
    padding: 7px 12px; font-size: 0.76rem;
    border: 1px solid rgba(217,119,6,0.35);
    background: transparent; color: #92400e;
 }

.btn-rec-save:hover { 
    background: rgba(251,191,36,0.10);
    border-color: rgba(217,119,6,0.65);
    color: #78350f;
}
html:not([data-theme="light"]) .btn-rec-save { color: #fbbf24; border-color: rgba(251,191,36,0.28); }
html:not([data-theme="light"]) .btn-rec-save:hover { background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.55); color: #fde68a; }




.btn-rec-reset { 
    padding: 7px 12px; font-size: 0.76rem;
    border: 1px solid var(--border-color);
    background: transparent; color: var(--text-muted);
 }
.btn-rec-reset:hover { 
    background: var(--hover-row); 
    color: var(--text-secondary); 
    border-color: var(--border-strong);
 }

 .btn-rec-copy { background: var(--text-main); }
.btn-rec-copy:hover { filter: brightness(1.2); }

.rec-char-warning {
    background: #f39c12; color: #fff; padding: 6px 10px; border-radius: 4px; 
    font-size: 0.8rem; font-weight: 700; display: flex; align-items: center;
}

/* Input para Edição de Título */
.btn-edit-title { cursor: pointer; opacity: 0.4; font-size: 0.8rem; transition: 0.2s; margin-left: 8px;}
.btn-edit-title:hover { opacity: 1; color: var(--accent-color); }
.input-edit-title {
    border: 1px solid var(--accent-color); border-radius: 4px; padding: 2px 6px;
    font-size: 1.1rem; font-weight: 700; color: var(--text-main); background: var(--input-bg);
    outline: none; max-width: 250px;
}

/* ============================================================
   6. BOTÕES DE AÇÃO (RODAPÉ)
   ============================================================ */
.receita-actions-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* ── Barra acima do textarea ── */
.editor-top-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

/* ── Botão + Popover "O que é isso na receita?" ── */
.editor-sintaxe-wrap { position: relative; }

.btn-sintaxe-dica {
    background: none;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-sintaxe-dica:hover { background: var(--tab-inactive); }

/* Botão "Receita inteligente" (substitui o popover-trigger antigo) */
.btn-receita-inteligente {
    background: none;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
}
.btn-receita-inteligente:hover { background: var(--tab-inactive); }
.btn-receita-inteligente.open {
    background: var(--accent-tint, rgba(0,86,179,0.08));
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Sanfona — herda quase todos os estilos do popover, mas inline (não fixed) */
.receita-inteligente-sanfona {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--bg-container);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.receita-inteligente-sanfona[hidden] { display: none; }
.receita-inteligente-sanfona table { border-collapse: collapse; width: 100%; font-size: 0.78rem; }
.receita-inteligente-sanfona th,
.receita-inteligente-sanfona td {
    padding: 4px 7px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-main);
}
.receita-inteligente-sanfona th {
    font-weight: 600;
    font-size: 0.73rem;
    background: var(--tab-inactive);
}
.receita-inteligente-sanfona .hl-amarelo,
.receita-inteligente-sanfona .hl-condicao,
.receita-inteligente-sanfona .hl-azul,
.receita-inteligente-sanfona .hl-calculado {
    border-radius: 3px;
    padding: 1px 4px;
    display: inline;
}
.receita-inteligente-sanfona .pop-section { border-bottom: 1px solid var(--border-color, #e5e7eb); padding-bottom: 9px; margin-bottom: 9px; }
.receita-inteligente-sanfona .pop-section-last { border-bottom: none; }
.receita-inteligente-sanfona .pop-section-title { font-size: 0.8rem; font-weight: 700; margin-bottom: 4px; color: var(--text-main); }
.receita-inteligente-sanfona .pop-desc { font-size: 0.78rem; color: var(--text-main); margin-bottom: 6px; line-height: 1.45; }
.receita-inteligente-sanfona .pop-note { font-size: 0.74rem; color: var(--text-main); margin-top: 5px; }
.receita-inteligente-sanfona .pop-row-removed td { color: #6b7280; text-decoration: line-through; }
.receita-inteligente-sanfona .pop-row-kept td { background: rgba(16, 185, 129, 0.07); }
.receita-inteligente-sanfona code { background: var(--tab-inactive); border-radius: 3px; padding: 1px 4px; font-size: 0.74rem; font-family: monospace; }

/* Botão lixeira no header da receita (desktop) */
.btn-excluir-receita {
    background: none;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #c0392b;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    transition: background 0.15s, border-color 0.15s;
}
.btn-excluir-receita:hover {
    background: rgba(192, 57, 43, 0.08);
    border-color: #c0392b;
}

/* Container Resetar/Salvar quando movido para o header (top) */
.status-save-receita-top { display: inline-flex; gap: 6px; align-items: center; }
.status-save-receita-top:empty { display: none; }

/* position:fixed para escapar de overflow:hidden nos ancestrais */
.editor-sintaxe-popover {
    display: none;
    position: fixed;
    z-index: 9000;
    background: var(--bg-container);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    padding: 12px 14px;
    min-width: 400px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.editor-sintaxe-popover.open { display: block; }

/* Título */
.pop-header-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

/* Seções */
.pop-section {
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    padding-bottom: 9px;
    margin-bottom: 9px;
}
.pop-section-last { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.pop-section-title {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}
.pop-desc {
    font-size: 0.75rem;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.45;
}
.pop-note {
    font-size: 0.72rem;
    color: var(--text-main);
    margin-top: 5px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

/* Tabelas */
.editor-sintaxe-popover table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.76rem;
}
.editor-sintaxe-popover th,
.editor-sintaxe-popover td {
    padding: 4px 7px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-main);
    vertical-align: middle;
}
.editor-sintaxe-popover th {
    font-weight: 600;
    font-size: 0.71rem;
    color: var(--text-main);
    background: var(--tab-inactive);
}
.editor-sintaxe-popover tr:last-child td { border-bottom: none; }

/* Highlights no popover — mesmo visual do overlay real */
.editor-sintaxe-popover .hl-amarelo,
.editor-sintaxe-popover .hl-condicao,
.editor-sintaxe-popover .hl-azul,
.editor-sintaxe-popover .hl-calculado {
    border-radius: 3px;
    padding: 1px 4px;
    display: inline;
}

/* Linha removida: texto riscado, cor cinza legível — sem opacity */
.pop-row-removed td { color: #6b7280; text-decoration: line-through; }
html:not([data-theme="light"]) .pop-row-removed td { color: #9ca3af; }

/* Linha mantida: destaque sutil */
.pop-row-kept td { background: rgba(16, 185, 129, 0.07); }

.pop-result-yes {
    color: #059669;
    font-weight: 600;
    font-size: 0.74rem;
    white-space: nowrap;
}
.pop-result-no {
    color: #6b7280;
    font-size: 0.74rem;
    white-space: nowrap;
}
html:not([data-theme="light"]) .pop-result-no { color: #9ca3af; }

/* code inline */
.editor-sintaxe-popover code {
    background: var(--tab-inactive);
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 0.72rem;
    font-family: monospace;
    color: var(--text-main);
}

.btn-action-receita {
    padding: 10px 24px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.9rem;
    border: none; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: transform 0.1s;
}
.btn-action-receita:active { transform: scale(0.98); }

/* Botão Secundário (Cinza) */
.btn-action-receita.sec {
    background: var(--tab-inactive); /* Adapta ao fundo */
    color: var(--text-main);
    border: 1px solid transparent; /* Para garantir alinhamento */
}
.btn-action-receita.sec:hover {
    background: var(--hover-row); /* Leve destaque no hover */
    border-color: var(--border-color);
}

/* Botão Primário (Destaque) */
.btn-action-receita.prim {
    background: var(--accent-color); 
    color: white; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.btn-action-receita.prim:hover {
    background: var(--accent-hover); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

@keyframes fadeIn { from { opacity:0; transform:translateX(-5px); } to { opacity:1; transform:translateX(0); } }

/* ============================================================
   HIGHLIGHT OVERLAY (###texto### → destaque visual)
   ============================================================ */
.editor-receita-wrapper {
    position: relative;
    flex: 1;
    /* display: block implícito — wrapper dimensionado pelo textarea (sem flex-direction:column),
       o mirror (absolute) preenche exatamente o espaço do textarea */
}

/* O div espelho fica atrás do textarea, pixel-perfect */
.editor-receita-mirror {
    position: absolute;
    top: 0; left: 0; right: 0;
    /* bottom e height definidos via JS em atualizarOverlay() para espelhar exatamente o textarea */
    padding: 20px;                      /* igual ao .editor-receita */
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: scroll;                 /* DEVE ser scroll (não hidden) para reservar o gutter da scrollbar igual ao textarea */
    pointer-events: none;               /* cliques passam direto para o textarea */
    border: 1px solid transparent;     /* ocupa o mesmo espaço mas invisível */
    border-radius: 8px;
    color: transparent;                 /* texto do mirror é transparente — só os spans aparecem */
    background: var(--input-bg);
    z-index: 0;
    box-sizing: border-box;
    scrollbar-color: transparent transparent; /* Firefox: mantém gutter, esconde visualmente */
}
/* Webkit: esconde a scrollbar visualmente mas MANTÉM o gutter (não usar display:none) */
.editor-receita-mirror::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* O textarea fica na frente, com texto transparente mas cursor visível */
.editor-receita-wrapper .editor-receita {
    position: relative;
    z-index: 1;
    background: transparent !important;
    color: transparent !important;
    caret-color: var(--text-main);      /* cursor continua visível */
    width: 100%;
    min-height: 430px;                  /* altura inicial — sem flex:1 o resize funciona livremente */
    box-sizing: border-box;
    overflow-y: scroll;                 /* força gutter sempre presente — alinha com o mirror */
    resize: vertical;
}

/* Destaques — ZERO padding e ZERO font-weight para não alterar fluxo do texto.
   box-shadow no lugar de border para não afetar o layout. */
.hl-receita {
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* ### amarelo/âmbar — campos a preencher */
.hl-amarelo {
    color: #5c3000;
    background: rgba(255, 175, 0, 0.20);
    box-shadow: 0 0 0 1.5px #d48a00;
}

/* === azul-ciano — observações/destaques clínicos */
.hl-azul {
    color: #05455a;
    background: rgba(0, 160, 190, 0.14);
    box-shadow: 0 0 0 1.5px #0090b0;
}

/* [se CONDIÇÃO] — lilás — dosagem condicional por idade/peso */
.hl-condicao {
    color: #4c1d95;
    background: rgba(139, 92, 246, 0.09);
    box-shadow: 0 0 0 1.5px #7c3aed;
    border-radius: 3px;
    /* padding removido — adicionava espaço horizontal extra desalinhando o overlay */
}

/* Animações de transição ao favoritar/desfavoritar receitas */
@keyframes favOut {
    to { opacity: 0; transform: scale(0.88); }
}
@keyframes favIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.receita-tab-item.fav-out { animation: favOut 0.18s ease forwards; }
.receita-tab-item.fav-in  { animation: favIn  0.28s ease both; }

/* Texto normal dentro do mirror precisa ser visível */
.editor-receita-mirror .mirror-text {
    color: var(--text-main);
}

/* =========================================
   DARK MODE — RECEITAS
   ========================================= */

/* Aba ativa: fundo azul tintado + borda accent */
html:not([data-theme="light"]) .receita-tab-item.active {
    background: rgba(16, 83, 164, 0.18);
    border-color: rgba(16, 83, 164, 0.6);
    color: var(--text-main);
    box-shadow: none;
}
html:not([data-theme="light"]) .receita-tab-item.active i {
    color: var(--text-main);
}

/* Botão Copiar receita = mesma aparência que Copiar HDA no dark mode */
/* btn-action-receita.prim dark — via var(--btn-copy-bg) em actions.css */

/* Input de busca mais claro */
html:not([data-theme="light"]) .search-receitas {
    background: #2e2e2e;
}

/* Highlights — texto legível sobre fundo semi-transparente escuro */
html:not([data-theme="light"]) .hl-amarelo {
    color: #fff8e0;
    background: rgba(255, 175, 0, 0.25);
    box-shadow: 0 0 0 1.5px #c88c00;
}
html:not([data-theme="light"]) .hl-azul {
    color: #d0f4ff;
    background: rgba(0, 160, 190, 0.20);
    box-shadow: 0 0 0 1.5px #008faa;
}
html:not([data-theme="light"]) .hl-condicao {
    color: #ddd6fe;
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 0 1.5px #7c3aed;
}

/* ============================================================
   NOVO LAYOUT COM SIDEBAR
   ============================================================ */

.receitas-layout-with-sidebar {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* ---- SIDEBAR ---- */
.receitas-sidebar {
    width: 185px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    padding: 10px;
    position: sticky;
    top: 68px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

html:not([data-theme="light"]) .receitas-sidebar {
    background: rgba(25,25,35,0.65);
    border-color: rgba(255,255,255,0.07);
}

.sidebar-perfil-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 7px 9px;
    background: var(--accent-color);
    border-radius: 8px;
    margin-bottom: 6px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

#sidebar-perfil-nome {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Toggle switch */
.sidebar-toggle-wrap {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 17px;
    flex-shrink: 0;
    cursor: pointer;
}
.sidebar-toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.sidebar-toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.25);
    border-radius: 17px;
    transition: 0.25s;
}
.sidebar-toggle-slider::before {
    content: '';
    position: absolute;
    width: 11px; height: 11px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
}
.sidebar-toggle-wrap input:checked + .sidebar-toggle-slider { background: rgba(255,255,255,0.45); }
.sidebar-toggle-wrap input:checked + .sidebar-toggle-slider::before { transform: translateX(15px); background: var(--accent-secondary); box-shadow: 0 0 0 2px rgba(255,255,255,0.75); }

/* Category items */
.sidebar-categorias-list { display: flex; flex-direction: column; gap: 2px; }

.sidebar-cat-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 500;
    color: var(--text-main);
    transition: background 0.12s;
    user-select: none;
}
.sidebar-cat-item:hover { background: var(--hover-row); }
.sidebar-cat-item.active {
    background: var(--cat-cor, var(--hover-row));
    font-weight: 700;
}
html:not([data-theme="light"]) .sidebar-cat-item.active { background: var(--cat-cor-dark, var(--hover-row)); }

.sidebar-cat-icon { font-size: 0.8rem; line-height: 1; flex-shrink: 0; width: 14px; text-align: center; }
.sidebar-cat-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- SEARCH KBD BADGE ---- */
.search-kbd-badge {
    position: absolute;
    right: 35px;
    top: 8px;
    display: inline;
    align-items: center;
    gap: 3px;
    pointer-events: none;
    user-select: none;
    opacity: 0.5;
}
.search-kbd-badge kbd {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 0.68rem;
    color: var(--text-main);
    opacity: 0.65;
    box-shadow: 0 1px 0 rgba(0,0,0,0.15);
    white-space: nowrap;
}
.search-kbd-or { font-size: 0.68rem; color: #aaa; }

/* ---- CATEGORY BADGE em cada receita ---- */
.rec-cat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 1rem;
    flex-shrink: 0;
    margin-right: 10px;
    margin-left: -4px;
    background: transparent;
    color: var(--cat-icon-color, #64748b);
}

/* Sem badge para o item fake */
.receita-tab-item[data-is-fake="true"] .rec-cat-badge { display: none; }

/* ---- ESTRELA DE FAVORITA — aparece no hover; sempre visível se já for favorita ---- */
.btn-fav-inline {
    position: absolute;
    top: 5px;
    right: 6px;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
    color: #fbbf24;
    cursor: default;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 2;
}
.btn-fav-inline.is-fav { opacity: 1; }
.btn-fav-inline.is-interactive { cursor: pointer; }
.receita-tab-item:hover .btn-fav-inline.is-interactive { opacity: 1; pointer-events: auto; }

/* ---- ÍCONE DE RECEITA DO USUÁRIO — canto inferior direito ---- */
.rec-user-badge {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.6rem;
    color: var(--accent-color);
    opacity: 0.45;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
}
.receita-tab-item:hover .rec-user-badge { opacity: 0.8; }

/* ---- COROA PREMIUM — canto inferior direito, âmbar (≠ amarelo da estrela) ---- */
.rec-premium-badge {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.78rem;
    color: #b45309;           /* âmbar escuro — distinto do amarelo #fbbf24 da estrela */
    opacity: 0.85;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.rec-premium-badge .fa-lock {
    font-size: 0.55rem;
    opacity: 0.75;
}
.receita-tab-item:hover .rec-premium-badge { opacity: 1; }

/* ---- BADGE DE CATEGORIA NO WORKSPACE (título h3) ---- */
.workspace-cat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-panel2);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 6px;
}
.workspace-cat-badge.editable {
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.workspace-cat-badge.editable:hover {
    background: var(--hover-row);
    transform: scale(1.12);
}

/* ---- PICKER DE CATEGORIAS (modal SweetAlert) ---- */
.cat-picker-modal-body { padding: 0 !important; }
.nova-rec-modal-body { padding: 0 4px !important; }
.cat-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 2px;
}
.cat-picker-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color, #e0e0e0);
    cursor: pointer;
    font-size: 0.78rem;
    transition: background 0.12s, border-color 0.12s;
    background: var(--bg-container, #fff);
}
.cat-picker-item:hover { background: var(--hover-row, #f0f0f0); }
.cat-picker-item.sel { border-color: var(--accent-color, #1053a4); background: rgba(16,83,164,0.08); font-weight: 700; }
.cat-picker-icon { font-size: 0.9rem; width: 14px; text-align: center; flex-shrink: 0; }
.cat-picker-label { color: var(--text-main, #333); white-space: nowrap; }

/* ---- MODAL NOVA PRESCRIÇÃO ---- */
.nova-rec-form { padding: 2px 0 4px; text-align: left; }
.nova-rec-row { margin-bottom: 14px; }
.nova-rec-row:last-child { margin-bottom: 0; }
.nova-rec-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}
.nova-rec-required { color: #ef4444; margin-left: 2px; }
.nova-rec-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-main, #f9f9f9);
    color: var(--text-main, #333);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
.nova-rec-input:focus { border-color: var(--accent-color, #1053a4); background: var(--bg-container, #fff); }
.nova-rec-select { cursor: pointer; }

/* Seleção de múltiplos perfis no modal de criar receita */
.swal-perfis-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.perfil-toggle-btn {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--rec-split-border, #dde1e9);
    background: transparent;
    color: var(--text-secondary, #666);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.14s;
    font-weight: 500;
}
.perfil-toggle-btn.active {
    border-color: var(--accent-color, #1053a4);
    background: rgba(16,83,164,0.09);
    color: var(--accent-color, #1053a4);
    font-weight: 700;
}
.perfil-toggle-btn:hover:not(.active) { background: var(--hover-row, #f0f0f0); }

/* Fillers: descartados pelo grid (display:none remove do flow) */
.receita-list-filler { display: none; }

/* ============================================================
   CALCULADORA DE DOSES (v6)
   ============================================================ */

/* Barra de peso */
#calc-peso-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1.5px solid #6ee7b7;
    border-radius: 10px;
    flex-wrap: wrap;
}
html:not([data-theme="light"]) #calc-peso-bar {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #059669;
}
.calc-peso-icon { color: #059669; font-size: 0.9rem; }
.calc-peso-label { font-size: 0.8rem; font-weight: 600; color: #065f46; white-space: nowrap; }
html:not([data-theme="light"]) .calc-peso-label { color: #6ee7b7; }
.calc-peso-input {
    width: 80px;
    padding: 4px 8px;
    border: 1.5px solid #6ee7b7;
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-container);
    color: var(--text-main);
    outline: none;
}
.calc-peso-input:focus { border-color: #059669; }
.calc-peso-unit { font-size: 0.8rem; color: var(--text-secondary); }
.calc-peso-btn-calc {
    padding: 4px 12px;
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
}
.calc-peso-btn-calc:hover { background: #047857; }
.calc-peso-btn-limpar {
    padding: 4px 8px;
    background: none;
    border: 1.5px solid #6ee7b7;
    border-radius: 6px;
    color: #065f46;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}
html:not([data-theme="light"]) .calc-peso-btn-limpar { color: #6ee7b7; border-color: #059669; }
.calc-peso-btn-limpar:hover { background: rgba(16,185,129,0.15); }

/* Highlight: valor calculado (verde) */
.hl-calculado {
    color: #065f46;
    background: rgba(16, 185, 129, 0.18);
    box-shadow: 0 0 0 1.5px #10b981;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    font-weight: 700;
}
html:not([data-theme="light"]) .hl-calculado {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.22);
}

/* Dica de fórmula (free) */
.hl-formula-hint {
    color: #6b7280;
    font-size: 0.82em;
    font-style: italic;
    margin-left: 2px;
}
html:not([data-theme="light"]) .hl-formula-hint { color: #9ca3af; }

/* Highlight: medicamento completo (teal/verde — novo sistema) */
.hl-med {
    color: #065f46;
    background: rgba(16, 185, 129, 0.14);
    border-radius: 4px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    padding: 1px 3px;
    font-weight: 600;
}
html:not([data-theme="light"]) .hl-med {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.18);
}

/* Badge de dose máxima */
.badge-dose-max {
    display: inline-block;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.75em;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}
html:not([data-theme="light"]) .badge-dose-max {
    background: #451a03;
    border-color: #d97706;
    color: #fcd34d;
}

/* ---- SEÇÃO PREMIUM — cor sólida no repouso, 2 flashes dourados a cada 12s ---- */
/*
 * Correções de shimmer aplicadas:
 * 1. Banda mais fina: 46%→50%→54% (~21% do elemento) em vez de 42%→58% (48%)
 * 2. Timing linear — velocidade constante, como reflexo de luz real
 * 3. Pausa real entre os 2 flashes (7.01%→11% em repouso antes do 2º sweep)
 * 4. background-repeat:no-repeat evita que a banda repita fora do elemento
 */

/* Receitas premium herdam o estilo padrão; apenas a coroa âmbar marca o status. */

/*
 * Keyframes: 2 flashes com pausa real entre eles
 * 0%→7%:   1º flash (0.84s a 12s)
 * 7%→11%:  pausa visível entre os flashes (0.48s)
 * 11%→18%: 2º flash (0.84s)
 * 18%→100%: repouso sólido (~9.8s)
 */
@keyframes shimmer-premium {
    0%      { background-position: 200% 50%; }
    7%      { background-position: -50%  50%; }
    7.01%,
    11%     { background-position: 200% 50%; }
    18%     { background-position: -50%  50%; }
    18.01%,
    100%    { background-position: 200% 50%; }
}


/* ---- TABS WRAPPER agora fica dentro do flex ---- */
.receitas-layout-with-sidebar .receitas-tabs-wrapper {
    flex: 1;
    min-width: 0;
    max-height: 600px;
    overflow-y: auto;
    padding: 2px;
}

/* ---- MOBILE ---- */
@media (max-width: 900px) {
    .receitas-layout-with-sidebar {
        flex-direction: column;
        gap: 8px;
    }
    .receitas-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        position: static;
        max-height: none;
        padding: 8px 10px;
        gap: 5px;
        align-items: center;
    }
    .sidebar-perfil-header {
        flex-shrink: 0;
        margin-bottom: 0;
        align-self: center;
        white-space: nowrap;
    }
    .sidebar-categorias-list {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
    }
    .sidebar-cat-item {
        flex-shrink: 0;
        padding: 5px 10px;
        border: 1px solid var(--border-color);
        border-radius: 16px;
        gap: 5px;
    }
    .sidebar-cat-label { display: inline; font-size: 0.72rem; }
    .search-kbd-badge { display: none; }
    .search-receitas { padding-right: 15px; }
    .receitas-layout-with-sidebar .receitas-tabs-wrapper {
        max-height: 60vh;
    }
}

/* ============================================================
   NOVO LAYOUT — PILLS + CARROSSEL (v5.1)
   ============================================================ */

/* --- Toolbar row: busca ocupa toda a largura e fica maior --- */
.receitas-toolbar .receitas-controls-row {
    gap: 12px;
}
.receitas-toolbar .search-input-wrapper {
    flex: 1;
}
.receitas-toolbar .search-receitas {
    max-width: none;
    padding: 16px 110px 16px 50px;
    font-size: 1.05rem;
    border-radius: 30px;
    border-width: 2px;
    font-weight: 500;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
html:not([data-theme="light"]) .receitas-toolbar .search-receitas {
    background: rgba(15, 23, 42, 0.7);
}
.receitas-toolbar .search-receitas:focus {
    border-width: 2px;
    box-shadow: 0 0 0 4px rgba(0,86,179,0.10);
}
.receitas-toolbar .search-icon {
    font-size: 0.95rem;
    left: 16px;
}

/* --- Row de pills — cursor grab no desktop --- */
.receitas-pills-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding: 2px 0 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    margin-bottom: 10px;
}
.receitas-pills-row::-webkit-scrollbar { display: none; }
.receitas-pills-row.dragging { cursor: grabbing; }

.pill-cat {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
}
html:not([data-theme="light"]) .pill-cat {
    background: rgba(255, 255, 255, 0.06);
}
.pill-cat:hover { background: var(--hover-row); }
.pill-cat.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    font-weight: 600;
}

/* Pill de perfil: primeiro da lista, estilo levemente diferente */
.pill-perfil {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    font-weight: 600;
    opacity: 1;
}
.pill-perfil.off {
    background: var(--bg-container);
    color: var(--text-main);
    border-color: var(--border-color);
    font-weight: 500;
    opacity: 0.75;
}
.pill-perfil .pill-toggle-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    flex-shrink: 0;
    transition: background 0.15s;
}
.pill-perfil.off .pill-toggle-dot {
    background: var(--border-color);
}

/* --- Blocos de seção --- */
.rec-bloco {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
}

/* Fundo diferenciado para "Seu Espaço" */
.rec-bloco-espaco {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.50);
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
html:not([data-theme="light"]) .rec-bloco-espaco {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

.rec-bloco-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

/* Título de seção mais proeminente */
.rec-bloco-titulo {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 7px;
}
.rec-bloco-titulo::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    border-radius: 2px;
    background: var(--accent-color);
    flex-shrink: 0;
}

.btn-ver-tudo {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #d3dded;
    background: rgba(255, 255, 255, 0.8);
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    transition: background 0.15s;
    text-decoration: none;
}
.btn-ver-tudo:hover { background: var(--hover-row); opacity: 1; }
html:not([data-theme="light"]) .btn-ver-tudo {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
}

.btn-ordem {
    margin-left: auto;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #d3dded;
    background: rgba(255, 255, 255, 0.8);
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}
.btn-ordem:hover { background: var(--hover-row); }
.btn-ordem.personalizada {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
html:not([data-theme="light"]) .btn-ordem {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
}

/* --- Carrossel --- */
.rec-carrossel {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.carousel-viewport {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.carousel-nav {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    align-self: center;
    transition: background 0.12s;
    line-height: 1;
    padding: 0;
}
.carousel-nav:hover:not(:disabled) { background: var(--hover-row); }
.carousel-nav:disabled { opacity: 0.25; cursor: default; }

/* Dots */
.carousel-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    min-height: 10px;
}
.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    border: none;
    padding: 0;
}
.carousel-dot.active {
    background: var(--accent-color);
    transform: scale(1.25);
}

/* Separador dentro de Seu Espaço */
.rec-grupo-sep {
    font-size: 0.68rem;
    color: var(--text-main);
    opacity: 0.38;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 2px 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.rec-grupo-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Grids dentro do carrossel ficam sem max-width */
.rec-grid-espaco,
#grid-perfil {
    max-height: none;
    overflow: visible;
}



/* --- Mobile para novo layout --- */
@media (max-width: 900px) {
    .carousel-nav {
        width: 22px;
        height: 22px;
        font-size: 0.95rem;
    }
    .rec-bloco-titulo { font-size: 0.68rem; }
}
/* ---- Botão X de limpar busca ---- */
.search-clear-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 1.4rem;
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    z-index: 2;
}
.search-clear-btn:hover { color: var(--text-main); background: var(--hover-row); }

/* ---- Animações de slide no carrossel ---- */
@keyframes carouselSlideFromRight {
    from { opacity: 0.5; transform: translateX(30px); }
    to   { opacity: 1;   transform: translateX(0);    }
}
@keyframes carouselSlideFromLeft {
    from { opacity: 0.5; transform: translateX(-30px); }
    to   { opacity: 1;   transform: translateX(0);     }
}
.carousel-viewport.animating-right .receitas-categoria-list {
    animation: carouselSlideFromRight 0.24s ease;
}
.carousel-viewport.animating-left .receitas-categoria-list {
    animation: carouselSlideFromLeft 0.24s ease;
}

/* ══════════════════════════════════════════════════════
   PAINEL LATERAL DE MEDICAMENTOS (medpanel)
   ══════════════════════════════════════════════════════ */

/* Workspace: coluna (barra no topo, corpo abaixo) */
.receita-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.receita-workspace-body {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}
.receita-editor-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Painel lateral */
.receita-medpanel {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}
html:not([data-theme="light"]) .receita-medpanel {
    background: var(--card-bg, #1f2937);
    border-color: var(--border, #374151);
}

/* Header do painel */
.medpanel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    position: sticky;
    top: 0;
    background: var(--card-bg, #fff);
    z-index: 1;
}
html:not([data-theme="light"]) .medpanel-header { background: var(--card-bg, #1f2937); }
.medpanel-titulo { font-weight: 700; font-size: 0.9rem; }
.medpanel-btn-fechar {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted, #6b7280); padding: 4px;
    border-radius: 4px; line-height: 1;
}
.medpanel-btn-fechar:hover { background: var(--hover-row, #f3f4f6); }

/* Lista de itens */
.medpanel-lista { display: flex; flex-direction: column; gap: 1px; background: var(--border, #e5e7eb); }
.medpanel-vazio { padding: 20px 16px; color: var(--text-muted, #6b7280); font-size: 0.85rem; text-align: center; }

/* Item acordeon — FECHADO */
.medpanel-item--fechado {
    background: var(--bg-muted, #f3f4f6);
    cursor: pointer;
}
html:not([data-theme="light"]) .medpanel-item--fechado { background: #1a2332; }

/* Item acordeon — ABERTO */
.medpanel-item--aberto {
    background: var(--card-bg, #fff);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
html:not([data-theme="light"]) .medpanel-item--aberto { background: #1f2937; }

/* Header do item */
.medpanel-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    gap: 8px;
    user-select: none;
}
.medpanel-item--fechado .medpanel-item-header { cursor: pointer; }
.medpanel-item-info { flex: 1; min-width: 0; }
.medpanel-item-nome { display: block; font-size: 1.1rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.medpanel-item-sub { display: block; font-size: 0.8rem; color: var(--text-muted, #6b7280); margin-top: 1px; }
.medpanel-chevron { color: var(--text-muted, #9ca3af); font-size: 0.85rem; flex-shrink: 0; }

/* Body do item (expandido) */
.medpanel-item-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.medpanel-loading { color: var(--text-muted, #6b7280); font-size: 0.85rem; padding: 8px 0; }

/* Campo */
.medpanel-field { display: flex; flex-direction: column; gap: 5px; }
.medpanel-field--duracao .medpanel-input-dur { width: 80px; }
.medpanel-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: 0.04em; }
.medpanel-select {
    width: 100%; padding: 7px 10px; border-radius: 8px;
    border: 1px solid var(--border, #d1d5db);
    background: var(--input-bg, #fff); color: var(--text-main);
    font-size: 0.85rem;
}
html:not([data-theme="light"]) .medpanel-select { background: #111827; border-color: #374151; color: #f3f4f6; }

.medpanel-dur-row {
    display: flex; align-items: center; gap: 8px;
}
.medpanel-slider {
    flex: 1; height: 4px; cursor: pointer;
    accent-color: var(--primary, #3b82f6);
}
.medpanel-input-dur {
    width: 52px; padding: 5px 8px; border-radius: 8px;
    border: 1px solid var(--border, #d1d5db);
    background: var(--input-bg, #fff); color: var(--text-main);
    font-size: 0.85rem; text-align: center;
}
html:not([data-theme="light"]) .medpanel-input-dur { background: #111827; border-color: #374151; color: #f3f4f6; }
.medpanel-dur-label { font-size: 0.8rem; color: var(--text-muted, #6b7280); white-space: nowrap; }

/* Grupo de botões (segmented control) */
.medpanel-btn-group {
    display: flex; gap: 6px; flex-wrap: nowrap;
    background: var(--bg-muted, #f3f4f6);
    border-radius: 10px; padding: 4px;
}
.medpanel-btn-group--wrap { flex-wrap: wrap; }
html:not([data-theme="light"]) .medpanel-btn-group { background: #111827; }

.mpbtn {
    flex: 1; padding: 7px 10px; border: none; border-radius: 7px;
    background: transparent; color: var(--text-muted, #6b7280);
    font-size: 0.8rem; font-weight: 700; cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.mpbtn:hover { background: rgba(255,255,255,0.7); color: var(--text-main); }
.mpbtn--ativo {
    background: #fff; color: var(--text-main);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
html:not([data-theme="light"]) .mpbtn { color: #9ca3af; }
html:not([data-theme="light"]) .mpbtn--ativo { background: #374151; color: #f3f4f6; }

/* Ações dentro do item */
.medpanel-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.medpanel-btn-excluir {
    background: none; border: none; cursor: pointer;
    color: #dc2626; font-size: 0.8rem; padding: 4px 8px; border-radius: 6px;
    display: flex; align-items: center; gap: 5px;
}
.medpanel-btn-excluir:hover { background: #fef2f2; }
html:not([data-theme="light"]) .medpanel-btn-excluir:hover { background: #3b0a0a; }

/* Footer com botão adicionar */
.medpanel-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border, #e5e7eb);
    position: sticky; bottom: 0;
    background: var(--card-bg, #fff);
}
html:not([data-theme="light"]) .medpanel-footer { background: var(--card-bg, #1f2937); }
.medpanel-btn-add {
    width: 100%; padding: 9px 12px; border-radius: 8px;
    background: var(--primary, #3b82f6); color: #fff; border: none; cursor: pointer;
    font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.medpanel-btn-add:hover { background: var(--primary-hover, #2563eb); }

/* Botão "Medicamentos" na toolbar */
.btn-action-receita.ghost {
    background: none; border: 1px solid var(--border, #d1d5db);
    color: var(--text-muted, #6b7280);
}
.btn-action-receita.ghost:hover, .btn-action-receita.ghost.ativo {
    background: var(--hover-row, #f3f4f6); color: var(--text-main);
}
html:not([data-theme="light"]) .btn-action-receita.ghost { border-color: #374151; color: #9ca3af; }
html:not([data-theme="light"]) .btn-action-receita.ghost:hover { background: #1f2937; color: #f3f4f6; }

/* Modal insertor */
.mpinsertor-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.mpinsertor-modal {
    background: var(--card-bg, #fff); border-radius: 12px;
    padding: 0; width: min(420px, 92vw);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
}
html:not([data-theme="light"]) .mpinsertor-modal { background: #1f2937; }
.mpinsertor-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e7eb);
}
.mpinsertor-header button { background:none; border:none; cursor:pointer; color:var(--text-muted,#6b7280); font-size:1.1rem; }
.mpinsertor-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.mpinsertor-footer { padding: 12px 18px; border-top: 1px solid var(--border, #e5e7eb); }

/* Mobile: painel abaixo do editor */
@media (max-width: 768px) {
    .receita-workspace { flex-direction: column; }
    .receita-medpanel  { width: 100%; max-height: 50vh; }
}

/* ============================================================
   BARRA DE DADOS DO PACIENTE
   ============================================================ */
.dados-paciente-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: var(--tab-inactive, #f3f4f6);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Wrapper dos campos (Peso + Idade) */
.dp-campos {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Um campo (Peso / Idade): label à esquerda, input à direita */
.dp-campo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 0 auto;
}

.dp-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary, #4e6080);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.dp-input-group {
    display: inline-flex;
    align-items: stretch;
    background: var(--input-bg, var(--bg-container, #fff));
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.dp-input-group:focus-within {
    border-color: var(--calc-accent);
    box-shadow: 0 0 0 3px var(--calc-accent-tint);
    background: var(--bg-container, #fff);
}

.dp-input-group input[type="number"] {
    width: 64px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--text-main, #111);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.dp-input-group input[type="number"]::-webkit-outer-spin-button,
.dp-input-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dp-input-group input[type="number"]:focus { outline: none; }

.dp-input-group select {
    padding: 0 8px;
    border: none;
    border-left: 1px solid var(--border-color, #d1d5db);
    background: transparent;
    color: var(--text-secondary, var(--text-main, #111));
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.dp-input-group select:focus { outline: none; }

.dp-unit {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    background: var(--tab-inactive, rgba(0,0,0,0.04));
    border-left: 1px solid var(--border-color, #d1d5db);
}

/* Coluna de botões */
.dp-acoes {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.dp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}

.dp-btn-calc {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: var(--calc-accent);
    color: #fff;
    font-size: 0.80rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
    box-shadow: 0 3px 12px var(--calc-accent-shadow);
}

.dp-btn-calc:hover {
    filter: brightness(1.07);
}

.dp-btn-reset {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}

.dp-btn-reset:hover:not([disabled]) {
    background: var(--hover-row);
}

.dp-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ============================================================
   REDESIGN — Calculadora de Doses (Modelo A · acento laranja)
   Aplica-se a .dados-paciente-bar.calc-rd. Troca o acento verde
   por --calc-accent e moderniza card/inputs/botões.
   ============================================================ */
.dados-paciente-bar.calc-rd {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-container);
    border: 1px solid var(--rec-split-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-split);
    padding: 14px;
    color: var(--text-main);
}

/* Cabeçalho do card */
.calc-rd .dp-head { display: flex; align-items: center; gap: 10px; }
.calc-rd .dp-head-icon {
    width: 36px; height: 36px; flex-shrink: 0;
    border-radius: 10px;
    background: var(--calc-accent-tint);
    color: var(--calc-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.calc-rd .dp-head-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.calc-rd .dp-head-title { font-size: 0.92rem; font-weight: 700; line-height: 1.15; color: var(--text-main); }
.calc-rd .dp-head-sub { font-size: 0.7rem; color: var(--text-muted); line-height: 1.2; }

@media (max-width: 900px) {
    .calc-rd .dp-head-title { font-size: 1.5rem; }
    .calc-rd .dp-head-sub { font-size: 0.8rem; }
}

/* Campos */
.calc-rd .dp-campos { display: flex; flex-direction: column; align-items: stretch; gap: 11px; }
.calc-rd .dp-campo {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 5px; min-width: 0;
}
.calc-rd .dp-label {
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
}
.calc-rd .dp-input-group {
    display: inline-flex; align-items: stretch;
    height: 46px;
    background: var(--input-bg);
    border: 1.5px solid var(--rec-split-border);
    border-radius: 11px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.calc-rd .dp-input-group:focus-within {
    border-color: var(--calc-accent);
    box-shadow: 0 0 0 3px var(--calc-accent-tint);
    background: var(--bg-container);
}
.calc-rd .dp-input-group input[type="number"] {
    flex: 1 1 auto; width: auto;
    border: none; background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.15rem; font-weight: 700;
    text-align: left; padding: 0 4px 0 13px;
    -moz-appearance: textfield;
}
.calc-rd .dp-input-group input:focus { outline: none; }
.calc-rd .dp-input-group input::placeholder { color: var(--text-muted); font-weight: 600; }
.calc-rd .dp-unit {
    display: inline-flex; align-items: center;
    padding: 0 13px;
    font-size: 0.82rem; font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border-left: 1px solid var(--rec-split-border);
}
/* Seletor (anos/meses): compacto, como uma "unidade", para o número dominar o campo */
.calc-rd .dp-input-group select {
    flex: 0 0 auto; width: auto;
    border: none; border-left: 1px solid var(--rec-split-border);
    background: transparent; color: var(--text-secondary);
    font-family: inherit; font-size: 0.82rem; font-weight: 600;
    padding: 0 26px 0 11px; cursor: pointer; outline: none;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%238a9ab8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 6px;
}
[data-theme="hospital"] .calc-rd .dp-input-group select,
[data-theme="carvao"] .calc-rd .dp-input-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23a8b3cc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
}

/* Ações */
.calc-rd .dp-acoes { display: flex; align-items: stretch; gap: 8px; }
.calc-rd .dp-btn-calc {
    flex: 1 1 auto;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 48px; padding: 0 14px;
    border: none; border-radius: 11px;
    background: var(--calc-accent);
    color: #fff;
    font-family: inherit; font-size: 0.92rem; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 12px var(--calc-accent-shadow);
    transition: filter 0.15s, transform 0.05s;
}
.calc-rd .dp-btn-calc:hover { filter: brightness(1.07); }
.calc-rd .dp-btn-calc:active { transform: translateY(1px); }
.calc-rd .dp-btn-calc i { font-size: 0.95rem; }
.calc-rd .dp-btn-reset {
    flex: 0 0 auto;
    width: 48px; height: 48px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--rec-split-border);
    border-radius: 11px;
    background: var(--input-bg);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.calc-rd .dp-btn-reset:hover:not([disabled]) {
    background: var(--calc-accent-tint);
    color: var(--calc-accent);
    border-color: var(--calc-accent);
}
.calc-rd .dp-btn-reset .dp-btn-reset-label { display: none; }

/* Linha de ajuda discreta (opcional) */
.calc-rd .dp-hint {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.7rem; color: var(--text-muted);
    line-height: 1.3;
}
.calc-rd .dp-hint i { color: var(--calc-accent); opacity: 0.8; }

/* ============================================================
   PAINEL INTELIGENTE
   ============================================================ */
.painel-inteligente {
    width: 250px;
    flex-shrink: 0;
    background: var(--tab-inactive, #f9fafb);
    overflow-y: auto;
    font-size: 0.83rem;
}

.pi-inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pi-titulo {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.pi-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pi-pergunta {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main, #374151);
    line-height: 1.35;
}

.pi-med-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pi-med-nome {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pi-med-comercial {
    font-weight: 400;
    text-transform: none;
    font-style: italic;
}

.pi-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pi-card {
    display: inline-block;
    padding: 4px 9px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}

.pi-card:hover {
    background: var(--accent-tint);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pi-card--sem-padrao {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Aviso dose máxima — compacto */
.pi-alerta-section {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pi-alerta-titulo {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pi-alerta-titulo i { color: #f59e0b; flex-shrink: 0; }
.pi-alerta-count { font-size: 0.82rem; font-weight: 400; color: #78350f; }

.pi-alerta-lista {
    margin: 2px 0 0 0;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pi-alerta-lista li {
    font-size: 0.76rem;
    color: #92400e;
}

.pi-alerta-formula {
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .receita-workspace-body { flex-direction: column; }
    .painel-inteligente { width: 100%; max-height: 40vh; }
    .dp-campo { max-width: 100%; }
}


/* pi-alerta dark fix */
html:not([data-theme="light"]) .pi-alerta-section {
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.45);
}
html:not([data-theme="light"]) .pi-alerta-titulo { color: #fbbf24; }
html:not([data-theme="light"]) .pi-alerta-count,
html:not([data-theme="light"]) .pi-alerta-lista li { color: #fcd34d; }
