  :root {
    /* ── Raquel Britzke Official Brand Palette ── */
    --leaf-green:  #294021;   /* Primary dark green */
    --teal:        #A8B8A6;   /* Sage / muted green */
    --off-white:   #EBE5D9;   /* Warm cream background */
    --taupe:       #DECCBA;   /* Warm border / card tone */
    --orange:      #D18C47;   /* Accent orange */
    --pop-yellow:  #FFFF5E;   /* CTA / active highlight */
    /* Backwards-compat aliases */
    --green-dark:  #294021;
    --green-med:   #A8B8A6;
    --green-light: #EBE5D9;
    --green-pale:  #F5F1E8;
    --blue-input:  #EBE5D9;
    --yellow-warn: #FFFF5E;
  }

  body { font-family: 'DM Sans', 'Inter', 'Segoe UI', sans-serif; background: #EBE5D9; color: #294021; }

  /* ─── TABS ─────────────────────────────────────── */
  .tab-btn { transition: all .2s; color: #294021; font-family: 'DM Sans', sans-serif; }
  .tab-btn.active {
    background: var(--leaf-green);
    color: #fff;
    border-bottom: 3px solid var(--pop-yellow);
  }
  .tab-btn:not(.active):hover { background: var(--off-white); color: var(--leaf-green); }
  .tab-panel { display: none; }
  .tab-panel.active { display: block; }

  /* ─── FORM ELEMENTS ─────────────────────────────── */
  .form-input {
    border: 1.5px solid var(--taupe);
    border-radius: 8px;
    padding: 8px 12px;
    width: 100%;
    background: #fff;
    font-size: 0.92rem;
    font-family: 'DM Sans', sans-serif;
    transition: border-color .2s;
  }
  .form-input:focus { outline: none; border-color: var(--leaf-green); background: #fff; }
  .form-label { font-size: 0.82rem; font-weight: 600; color: var(--leaf-green); margin-bottom: 3px; display: block; }

  /* ─── CARDS ─────────────────────────────────────── */
  .card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(41,64,33,.08);
    padding: 20px;
    border: 1px solid var(--taupe);
  }

  /* ─── AI OUTPUT ─────────────────────────────────── */
  #ai-output h1,#ai-output h2,#ai-output h3 { color: var(--leaf-green); margin: 14px 0 6px; font-weight: 700; font-family: 'Playfair Display', Georgia, serif; }
  #ai-output h1 { font-size: 1.3rem; border-bottom: 2px solid var(--taupe); padding-bottom: 4px; }
  #ai-output h2 { font-size: 1.1rem; }
  #ai-output h3 { font-size: 1rem; }
  #ai-output ul,#ai-output ol { margin: 6px 0 10px 18px; }
  #ai-output li { margin-bottom: 3px; font-size: 0.9rem; }
  #ai-output strong { color: var(--leaf-green); }
  #ai-output table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.85rem; }
  #ai-output th { background: var(--leaf-green); color: #fff; padding: 7px 10px; text-align: left; }
  #ai-output td { padding: 6px 10px; border-bottom: 1px solid var(--taupe); }
  #ai-output tr:nth-child(even) td { background: var(--off-white); }
  #ai-output p { margin: 6px 0; font-size: 0.9rem; line-height: 1.6; }
  #ai-output blockquote { border-left: 3px solid var(--orange); padding-left: 12px; color: #555; font-style: italic; margin: 10px 0; background: var(--off-white); padding: 10px 14px; border-radius: 5px; }

  /* ─── TABLE STYLING FOR MEAL PLANS ──────────────── */
  #ai-output table { width:100%; border-collapse:collapse; margin:12px 0 20px; font-size:0.85rem; }
  #ai-output table th { background:#294021; color:#fff; padding:10px 12px; text-align:left; font-weight:600; font-size:0.78rem; text-transform:uppercase; letter-spacing:0.5px; }
  #ai-output table td { padding:8px 12px; border-bottom:1px solid #DECCBA; vertical-align:top; }
  #ai-output table tr:nth-child(even) { background:#EBE5D9; }
  #ai-output table tr:hover { background:#F5F1E8; }
  #ai-output table tr:last-child td { font-weight:600; background:#EBE5D9; border-top:2px solid #294021; }

  /* ─── EDIT MODE ──────────────────────────────────── */
  #ai-output.editing-mode { border:2px dashed #294021; border-radius:10px; padding:16px; min-height:200px; background:#FAFAF5; }
  #ai-output.editing-mode td, #ai-output.editing-mode th { cursor:text; min-width:60px; transition:background 0.1s; }
  #ai-output.editing-mode td:hover, #ai-output.editing-mode th:hover { background:#EBE5D9 !important; }
  #ai-output.editing-mode td:focus, #ai-output.editing-mode th:focus { outline:2px solid #294021; outline-offset:-1px; background:#fff !important; box-shadow:0 0 0 3px rgba(41,64,33,0.15); }
  #ai-output.editing-mode h1, #ai-output.editing-mode h2, #ai-output.editing-mode h3, #ai-output.editing-mode h4,
  #ai-output.editing-mode p, #ai-output.editing-mode li, #ai-output.editing-mode strong { cursor:text; border-radius:4px; padding:2px 6px; transition:background 0.1s; }
  #ai-output.editing-mode h1:hover, #ai-output.editing-mode h2:hover, #ai-output.editing-mode h3:hover, #ai-output.editing-mode h4:hover,
  #ai-output.editing-mode p:hover, #ai-output.editing-mode li:hover, #ai-output.editing-mode strong:hover { background:#EBE5D9; }
  #ai-output.editing-mode h1:focus, #ai-output.editing-mode h2:focus, #ai-output.editing-mode h3:focus, #ai-output.editing-mode h4:focus,
  #ai-output.editing-mode p:focus, #ai-output.editing-mode li:focus, #ai-output.editing-mode strong:focus { outline:2px solid #294021; outline-offset:2px; background:#fff; }

  #edit-toolbar { display:none; background:linear-gradient(135deg,#EBE5D9,#DECCBA); border:2px solid #294021; border-radius:12px; padding:12px 18px; margin-bottom:14px; gap:8px; align-items:center; flex-wrap:wrap; box-shadow:0 2px 8px rgba(41,64,33,0.12); }
  #edit-toolbar.active { display:flex; }
  #edit-toolbar button { padding:7px 14px; border:1px solid #DECCBA; border-radius:8px; background:#fff; font-size:0.82rem; cursor:pointer; color:#294021; transition:all 0.15s; font-weight:500; }
  #edit-toolbar button:hover { background:#EBE5D9; border-color:#294021; transform:translateY(-1px); }
  #edit-toolbar .separator { width:1px; height:24px; background:#A8B8A6; margin:0 6px; }
  #edit-toolbar .edit-hint { font-size:0.78rem; color:#294021; margin-left:auto; font-weight:500; }

  /* Row action buttons (add/delete row) */
  #ai-output.editing-mode tr { position:relative; transition:background 0.1s; }
  #ai-output.editing-mode tr.row-selected { background:#EBE5D9 !important; outline:2px solid #294021; outline-offset:-1px; }
  .row-actions { position:absolute; right:-70px; top:50%; transform:translateY(-50%); display:flex; gap:3px; opacity:0; transition:opacity 0.15s; }
  #ai-output.editing-mode tr:hover .row-actions { opacity:1; }
  .row-action-btn { width:26px; height:26px; border:1px solid #d1d5db; border-radius:6px; background:#fff; cursor:pointer; font-size:0.72rem; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
  .row-action-btn:hover { background:#fee2e2; border-color:#fca5a5; }
  .row-action-btn.add:hover { background:#dcfce7; border-color:#86efac; }

  /* Edit banner that appears above the plan */
  .edit-banner { background:linear-gradient(135deg,#294021,#3a5a2c); color:#fff; padding:10px 18px; border-radius:10px; margin-bottom:12px; display:flex; align-items:center; gap:10px; font-size:0.85rem; font-weight:500; }
  .edit-banner .shortcut-badge { background:rgba(255,255,255,0.25); padding:2px 8px; border-radius:4px; font-size:0.75rem; font-family:monospace; }

  /* Swap button injected next to meal headings */
  .btn-trocar-refeicao { display:inline-flex; align-items:center; gap:4px; margin-left:8px; padding:3px 10px; background:#FFFF5E; border:1px solid #D18C47; border-radius:14px; font-size:0.72rem; font-weight:600; cursor:pointer; color:#294021; vertical-align:middle; transition:all 0.15s; }
  .btn-trocar-refeicao:hover { background:#D18C47; color:#fff; }
  .btn-trocar-refeicao.loading { opacity:0.6; pointer-events:none; }

  /* Swap suggestion popup */
  .swap-popup { position:absolute; z-index:10000; background:#fff; border:1.5px solid var(--taupe); border-radius:12px; box-shadow:0 8px 32px rgba(41,64,33,0.15); padding:16px; max-width:420px; min-width:300px; font-family:'DM Sans',system-ui,sans-serif; }
  .swap-popup h4 { font-size:0.9rem; color:#294021; margin:0 0 10px; font-family:'DM Sans',sans-serif; }
  .swap-option { padding:10px 12px; border:1.5px solid var(--taupe); border-radius:8px; margin-bottom:8px; cursor:pointer; font-size:0.82rem; transition:all 0.15s; }
  .swap-option:hover { background:var(--off-white); border-color:var(--leaf-green); }
  .swap-option .swap-name { font-weight:600; color:#294021; }
  .swap-option .swap-detail { color:#888; font-size:0.78rem; margin-top:2px; }

  /* ─── RECIPE CARDS ──────────────────────────────── */
  .recipe-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--taupe);
    padding: 14px;
    transition: box-shadow .2s, transform .2s;
    cursor: pointer;
  }
  .recipe-card:hover { box-shadow: 0 4px 16px rgba(41,64,33,.14); transform: translateY(-2px); }
  .recipe-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--off-white);
    color: var(--leaf-green);
    margin: 2px;
    border: 1px solid var(--teal);
  }

  /* ─── HISTORY ITEMS ─────────────────────────────── */
  .hist-item {
    background: #fff;
    border: 1px solid var(--taupe);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* ─── BUTTONS ────────────────────────────────────── */
  .btn-primary {
    background: var(--leaf-green);
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s;
  }
  .btn-primary:hover { background: #3a5a2c; transform: translateY(-1px); }
  .btn-primary:disabled { background: #9cb9a8; cursor: not-allowed; transform: none; }
  /* CTA button: Pop Yellow + Leaf Green text (brand primary CTA) */
  .btn-cta {
    background: var(--pop-yellow);
    color: var(--leaf-green);
    padding: 10px 22px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s;
  }
  .btn-cta:hover { background: #f0f040; transform: translateY(-1px); }
  .btn-secondary {
    background: #fff;
    color: var(--leaf-green);
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: 2px solid var(--taupe);
    transition: all .2s;
  }
  .btn-secondary:hover { background: var(--off-white); border-color: var(--leaf-green); }
  .btn-danger {
    background: #fff;
    color: #c0392b;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: 1.5px solid #e74c3c;
    transition: all .2s;
  }
  .btn-danger:hover { background: #ffeaea; }

  /* ─── LOADER ─────────────────────────────────────── */
  .loader {
    width: 32px; height: 32px;
    border: 4px solid var(--taupe);
    border-top-color: var(--leaf-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-step { transition: color 0.3s, font-weight 0.3s; }
  .loading-step.active { color: var(--leaf-green); font-weight: 700; }
  .loading-step.done { color: var(--teal); }
  @keyframes pulse-edit {
    0%, 100% { box-shadow: 0 2px 8px rgba(41,64,33,0.3); }
    50%      { box-shadow: 0 2px 16px rgba(41,64,33,0.6), 0 0 0 4px rgba(41,64,33,0.15); }
  }

  /* ─── MODAL ──────────────────────────────────────── */
  .modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
  }
  .modal-box {
    background: #fff;
    border-radius: 14px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
  }

  /* ─── STAT BADGES ─────────────────────────────────── */
  .stat-badge {
    background: var(--off-white);
    border: 1px solid var(--taupe);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: center;
  }
  .stat-badge .val { font-size: 1.4rem; font-weight: 800; color: var(--leaf-green); font-family: 'Playfair Display', serif; }
  .stat-badge .lbl { font-size: 0.72rem; color: #777; font-weight: 600; }

  /* ─── PRINT STYLES — Raquel Britzke Brand Identity ── */
  /* ── Branded 7-day meal plan table ── */
  .plan-table-wrap {
    font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
    background: #EBE5D9;
    border-radius: 12px;
    padding: 24px 24px 14px;
    margin-bottom: 16px;
    border: 1px solid #DECCBA;
  }
  .plan-brand-header {
    display: flex;
    align-items: baseline;
    gap: 24px;
    border-bottom: 2px solid #294021;
    padding-bottom: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  /* "Raquel" in DM Sans, "Britzke" in Playfair – matching the logo style */
  .plan-brand-name .rb-raquel {
    font-family: 'DM Sans', 'Helvetica Neue', sans-serif;
    font-weight: 700;
    color: #294021;
    font-size: 1.6rem;
  }
  .plan-brand-name .rb-britzke {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    color: #294021;
    font-size: 1.6rem;
  }
  .plan-brand-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: #294021;
    letter-spacing: -0.3px;
    display: flex;
    gap: 6px;
    align-items: baseline;
  }
  .plan-brand-nutri { font-size: 0.82rem; color: #A8B8A6; font-family: 'DM Sans', sans-serif; }
  .plan-brand-title { margin-left: auto; text-align: right; }
  .plan-label { font-size: 0.88rem; color: #A8B8A6; font-weight: 600; font-family: 'DM Sans', sans-serif; }
  .plan-subtitle { font-size: 0.9rem; color: #294021; font-weight: 700; font-family: 'DM Sans', sans-serif; }
  .plan-7day-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    color: #294021;
    table-layout: fixed;
    font-family: 'DM Sans', sans-serif;
  }
  .plan-th-row {
    width: 72px;
    min-width: 66px;
    background: transparent;
    border: none;
  }
  .plan-th-day {
    color: #294021;
    font-weight: 700;
    font-size: 0.78rem;
    text-align: center;
    padding: 8px 6px 6px;
    border-bottom: 2px solid #294021;
    letter-spacing: .3px;
    background: #A8B8A6;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .plan-td-label {
    font-weight: 700;
    color: #294021;
    font-size: 0.7rem;
    vertical-align: top;
    padding: 10px 8px 10px 6px;
    border-bottom: 1px solid #DECCBA;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: #e8ede5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .plan-td-meal {
    vertical-align: top;
    padding: 9px 7px;
    border-bottom: 1px solid #DECCBA;
    border-left: 1px solid #DECCBA;
    line-height: 1.55;
    color: #294021;
    font-size: 0.77rem;
    background: #fff;
  }
  .plan-7day-table tbody tr:nth-child(odd) .plan-td-meal { background: #F5F1E8; }
  .plan-7day-table tbody tr:last-child .plan-td-label,
  .plan-7day-table tbody tr:last-child .plan-td-meal {
    border-bottom: none;
  }
  .plan-footer-note {
    font-size: 0.75rem;
    color: #A8B8A6;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #DECCBA;
    font-style: italic;
    font-family: 'DM Sans', sans-serif;
  }
  .plan-shopping {
    background: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 16px;
    border: 1px solid #DECCBA;
    font-family: 'DM Sans', sans-serif;
  }
  /* kcal badge per meal (shown below food description) */
  .plan-meal-kcal {
    margin-top: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #A8B8A6;
    letter-spacing: .3px;
  }
  .plan-shopping h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: #294021;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #DECCBA;
  }
  .plan-shopping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .plan-shopping-cat h5 {
    font-size: 0.72rem;
    font-weight: 700;
    color: #A8B8A6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 6px;
  }
  .plan-shopping-cat ul { list-style: none; padding: 0; margin: 0; }
  .plan-shopping-cat li { font-size: 0.8rem; color: #294021; padding: 2px 0; }
  .plan-shopping-cat li::before { content: "·  "; color: #D18C47; font-weight: 700; }

  /* ── Anti-copy: protect patient data ── */
  .tab-panel, #paciente-detail, #pac-panel-dados, #pac-panel-consultas,
  #pac-panel-medidas, #pac-panel-notas, .consulta-grid {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  /* Allow selection inside inputs, textareas, and the plan output */
  input, textarea, select,
  #plano-output, #plano-renderizado, .plano-content {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
  }

  @media print {
    @page { margin: 10mm 12mm 12mm 12mm; size: A4 landscape; }
    body {
      background: #fff !important;
      font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
      color: #294021; font-size: 9pt; line-height: 1.55;
    }
    .no-print, nav, header, footer, .modal-bg, .tab-btn, button, .toast { display: none !important; }
    #print-area { display: block !important; max-width: 100%; }

    /* ── Brand Header ── */
    .print-brand-header {
      display: flex; align-items: center; justify-content: space-between;
      border-bottom: 2.5px solid #294021; padding-bottom: 12px; margin-bottom: 20px;
    }
    .print-brand-header .brand-name {
      font-family: 'Georgia', 'Times New Roman', serif;
      font-size: 22pt; font-weight: 700; color: #294021;
      letter-spacing: -0.5px; margin: 0;
    }
    .print-brand-header .brand-subtitle {
      font-family: 'Helvetica Neue', Arial, sans-serif;
      font-size: 8pt; color: #A8B8A6; margin: 3px 0 0;
      letter-spacing: 0.3px;
    }
    .print-brand-monogram {
      width: 46px; height: 46px; background: #294021; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-family: 'Georgia', serif; font-size: 17pt; font-weight: 700;
      color: #FFFF5E; flex-shrink: 0;
    }

    /* ── Patient Card ── */
    .print-patient-card {
      background: #EBE5D9; border-radius: 10px; padding: 16px 20px;
      margin-bottom: 20px; font-size: 8.5pt;
    }
    .print-patient-card .patient-title {
      font-family: 'Georgia', serif; font-size: 10pt; font-weight: 700;
      color: #294021; margin: 0 0 10px;
      text-transform: uppercase; letter-spacing: 1.5px;
    }
    .print-patient-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 5px 28px;
    }
    .print-patient-grid span { color: #294021; }
    .print-patient-grid strong { color: #294021; font-weight: 600; }

    /* ── Hydration Box ── */
    .print-hydration {
      background: #A8B8A6; border-radius: 10px;
      padding: 12px 18px; margin-bottom: 22px;
      display: flex; align-items: center; gap: 12px; color: #294021;
    }
    .print-hydration .hydration-icon { font-size: 20pt; flex-shrink: 0; }
    .print-hydration .hydration-text { font-size: 9pt; }
    .print-hydration .hydration-value { font-size: 12pt; font-weight: 700; color: #294021; }

    /* ── Plan Content ── */
    .print-plan-body {
      font-size: 9pt; line-height: 1.6; color: #294021;
    }
    .print-plan-body h1, .print-plan-body h2, .print-plan-body h3 {
      font-family: 'Georgia', 'Times New Roman', serif;
      color: #294021; page-break-after: avoid;
    }
    .print-plan-body h2 {
      font-size: 12pt; font-weight: 700; margin: 22px 0 8px;
      padding: 7px 14px; background: #294021; color: #EBE5D9;
      border-radius: 5px; letter-spacing: 0.3px;
    }
    .print-plan-body h3 {
      font-size: 10pt; font-weight: 700; margin: 14px 0 5px;
      color: #294021; border-bottom: 1.5px solid #DECCBA; padding-bottom: 3px;
    }
    .print-plan-body ul, .print-plan-body ol {
      padding-left: 16px; margin: 4px 0;
    }
    .print-plan-body li {
      margin-bottom: 2px; color: #294021; font-size: 8.5pt;
    }
    .print-plan-body strong { color: #294021; }
    .print-plan-body blockquote {
      margin: 10px 0; padding: 8px 14px;
      background: #EBE5D9; border-left: 4px solid #D18C47;
      border-radius: 5px; font-size: 9pt;
    }
    .print-plan-body blockquote p { margin: 0; color: #294021; }
    .print-plan-body table {
      width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 8.5pt;
    }
    .print-plan-body table th {
      background: #294021; color: #EBE5D9; padding: 6px 10px;
      text-align: left; font-size: 8pt; font-weight: 600;
      text-transform: uppercase; letter-spacing: 0.5px;
    }
    .print-plan-body table td {
      padding: 5px 10px; border-bottom: 1px solid #DECCBA; color: #294021;
    }
    .print-plan-body table tr:nth-child(even) td { background: #EBE5D9; }

    /* ── Recommendations ── */
    .print-recommendations {
      margin-top: 26px; padding: 16px 20px;
      background: #EBE5D9; border-radius: 10px;
      border-left: 5px solid #D18C47;
      page-break-inside: avoid;
    }
    .print-recommendations h3 {
      font-family: 'Georgia', serif; font-size: 11pt; font-weight: 700;
      color: #294021; margin: 0 0 10px; padding-bottom: 6px;
      border-bottom: 1.5px solid #DECCBA;
    }
    .print-recommendations ol {
      margin: 0; padding-left: 18px; font-size: 8.5pt; line-height: 1.75; color: #294021;
    }
    .print-recommendations li { margin-bottom: 3px; }

    /* ── Substitution Table ── */
    .print-substitutions {
      margin-top: 26px; page-break-inside: avoid;
    }
    .print-substitutions h3 {
      font-family: 'Georgia', serif; font-size: 11pt; font-weight: 700;
      color: #294021; margin: 0 0 8px; padding-bottom: 6px;
      border-bottom: 1.5px solid #A8B8A6;
    }
    .print-substitutions p.sub-desc {
      font-size: 8pt; color: #A8B8A6; margin: 0 0 8px; font-style: italic;
    }
    .print-substitutions table {
      width: 100%; border-collapse: collapse; font-size: 8.5pt;
    }
    .print-substitutions table th {
      background: #294021; color: #EBE5D9; padding: 6px 10px;
      text-align: left; font-weight: 600; font-size: 7.5pt;
      text-transform: uppercase; letter-spacing: 0.5px;
    }
    .print-substitutions table td {
      padding: 5px 10px; border-bottom: 1px solid #DECCBA; color: #294021;
    }
    .print-substitutions table tr:nth-child(even) td { background: #EBE5D9; }
    .print-sub-arrow { color: #D18C47; font-weight: 700; text-align: center; }

    /* ── Footer ── */
    .print-footer {
      margin-top: 30px; padding-top: 10px; border-top: 2px solid #294021;
      display: flex; justify-content: space-between; align-items: center;
      font-size: 7.5pt; color: #A8B8A6;
    }
    .print-footer .footer-brand {
      font-family: 'Georgia', serif; font-weight: 600; color: #294021;
    }

    /* ── Page breaks ── */
    .print-plan-body h2 { page-break-before: auto; }
    .print-recommendations, .print-substitutions { page-break-before: auto; }

    /* ── Branded 7-day plan table (print) ── */
    .plan-table-wrap {
      background: #fff !important;
      border: none !important;
      border-radius: 0 !important;
      padding: 0 !important;
      font-family: 'Helvetica Neue', Arial, sans-serif;
      page-break-inside: avoid;
    }
    .plan-brand-header {
      display: flex !important;
      align-items: baseline;
      gap: 18px;
      border-bottom: 2.5px solid #294021 !important;
      padding-bottom: 10px !important;
      margin-bottom: 14px !important;
    }
    .plan-brand-name { font-size: 20pt; color: #294021 !important; }
    .plan-brand-name .rb-raquel { font-family: 'Helvetica Neue', Arial, sans-serif; font-weight: 700; color: #294021; }
    .plan-brand-name .rb-britzke { font-family: Georgia, 'Times New Roman', serif; font-weight: 600; color: #294021; }
    .plan-brand-nutri { font-size: 7.5pt; color: #A8B8A6; }
    .plan-label { font-size: 7.5pt; color: #A8B8A6; }
    .plan-subtitle { font-size: 8.5pt; font-weight: 700; color: #294021; }
    .plan-7day-table { font-size: 7pt; color: #294021; page-break-inside: avoid; }
    .plan-th-day {
      color: #294021 !important;
      font-weight: 700;
      font-size: 7pt;
      text-align: center;
      padding: 5px 4px 4px;
      border-bottom: 2px solid #294021 !important;
      background: #A8B8A6 !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .plan-td-label {
      font-weight: 700;
      color: #294021 !important;
      font-size: 6.5pt;
      padding: 6px 6px 6px 4px;
      border-bottom: 0.75pt solid #DECCBA !important;
      white-space: nowrap;
      vertical-align: top;
      text-transform: uppercase;
      letter-spacing: .3px;
      background: #e8ede5 !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .plan-td-meal {
      font-size: 7pt;
      padding: 7px 5px;
      border-bottom: 0.75pt solid #DECCBA !important;
      border-left: 0.75pt solid #DECCBA !important;
      vertical-align: top;
      line-height: 1.45;
      color: #294021 !important;
      background: #fff !important;
    }
    .plan-7day-table tbody tr:nth-child(odd) .plan-td-meal {
      background: #EBE5D9 !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .plan-footer-note { font-size: 6.5pt; color: #A8B8A6; border-top: 0.75pt solid #DECCBA; margin-top: 8pt; padding-top: 6pt; }
    .plan-shopping {
      border: 1pt solid #DECCBA !important;
      border-radius: 6pt;
      padding: 10pt 12pt !important;
      margin-top: 12pt;
      page-break-inside: avoid;
    }
    .plan-shopping h4 { font-size: 10pt; color: #294021; border-bottom: 0.75pt solid #DECCBA; padding-bottom: 5pt; margin-bottom: 8pt; }
    .plan-shopping-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt; }
    .plan-shopping-cat h5 { font-size: 6.5pt; color: #A8B8A6; text-transform: uppercase; letter-spacing: 0.5pt; margin: 0 0 4pt; }
    .plan-shopping-cat li { font-size: 7pt; color: #294021; }
  }
  #print-area { display: none; }

  /* ─── MISC ───────────────────────────────────────── */
  .section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-dark);
    padding: 10px 14px;
    background: var(--green-light);
    border-radius: 8px;
    border-left: 4px solid var(--green-dark);
    margin-bottom: 14px;
  }
  .tooltip { position: relative; }
  .tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 99;
  }
  .pill-select {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
  }
  .pill-opt {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid #b0d8be;
    background: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
  }
  .pill-opt.selected {
    background: var(--green-dark);
    color: #fff;
    border-color: var(--green-dark);
  }
  textarea.form-input { resize: vertical; min-height: 80px; }
  select.form-input { cursor: pointer; }

  /* ─── RESPONSIVE LAYOUT ─────────────────────────── */
  .consulta-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
  }
  @media (max-width: 900px) {
    .consulta-grid { grid-template-columns: 1fr; }
  }

  /* ─── ACTION BUTTON BAR ────────────────────────── */
  .action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
  }
  .action-bar .btn-secondary {
    font-size: 0.8rem;
    padding: 6px 12px;
    white-space: nowrap;
  }

  /* ─── GENERATE BUTTONS ──────────────────────────── */
  .gen-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  .gen-buttons .btn-primary { flex: 1; min-width: 180px; }

  /* ─── HEADER RESPONSIVE ─────────────────────────── */
  @media (max-width: 600px) {
    header { padding: 10px 14px; }
    header > div:first-child > div:last-child > div:first-child { font-size: 0.95rem; }
    .tab-btn { font-size: 0.75rem; padding: 8px 10px !important; }
    nav { padding: 0 8px; overflow-x: auto; }
    .consulta-grid { gap: 12px; }
    .card { padding: 14px; }
    .modal-box { padding: 18px; }
  }

  /* ─── CONSISTENT SPACING ────────────────────────── */
  .gap-sm { gap: 8px; }
  .gap-md { gap: 12px; }
  .gap-lg { gap: 20px; }
  .mb-sm { margin-bottom: 8px; }
  .mb-md { margin-bottom: 16px; }


/* ─── RESPONSIVE: Main Patient Layout ────────── */
@media (max-width: 768px) {
  #panel-pacientes > div {
    flex-direction: column !important;
  }
  #panel-pacientes > div > div:first-child {
    width: 100% !important;
    min-width: unset !important;
  }
  #panel-pacientes > div > div:last-child {
    min-width: unset !important;
  }
  #panel-consulta > div {
    flex-direction: column !important;
  }
  #panel-consulta > div > div:first-child {
    width: 100% !important;
    min-width: unset !important;
  }
  .modal-box {
    max-width: 95vw !important;
    padding: 14px !important;
  }
  #panel-planos > div {
    flex-direction: column !important;
  }
  #panel-planos > div > div:first-child {
    width: 100% !important;
    min-width: unset !important;
  }
}
