/* ═══════════════════════════════════════
   EducaFood Coach – Estilo 4eat (Light & Clean)
   ═══════════════════════════════════════ */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --surface3: #f3f4f6;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #00C48C; /* Verde vibrante tipo 4eat */
  --brand2: #00a877;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 4px 20px rgba(0,0,0,0.05);
  --shadow-hover: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 20px;
  --radius-sm: 12px;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);min-height:100vh;line-height:1.6;overflow-x:hidden}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2,h3{font-family:'Inter',sans-serif;font-weight:800;letter-spacing:-0.02em;line-height:1.2}
a{color:inherit}

/* ── UTILS ── */
.hidden{display:none!important}
.eyebrow{font-size:.75rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--brand);margin-bottom:6px}
.muted{color:var(--muted);font-size:.9rem}
.error-msg{color:var(--danger);font-size:.85rem;margin-top:6px}
.stack-gap{display:grid;gap:18px}

/* ══ LOGIN ══ */
.login-screen{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;
  background:var(--bg);z-index:100}
.login-bg-orb{position:absolute;border-radius:50%;filter:blur(80px);pointer-events:none;opacity:0.6}
.orb1{width:400px;height:400px;background:rgba(0,196,140,.2);top:-100px;left:-100px}
.orb2{width:300px;height:300px;background:rgba(14,165,233,.15);bottom:-80px;right:-80px}
.login-card{background:var(--surface);border:1px solid var(--border);border-radius:28px;
  padding:48px 40px;width:min(420px,90vw);box-shadow:var(--shadow);position:relative;z-index:1}
.login-logo{text-align:center;margin-bottom:32px}
.login-logo .logo-icon{font-size:3rem;display:block;margin-bottom:12px}
.login-logo h1{font-size:2.2rem;color:var(--text);margin:0}
.login-logo p{color:var(--muted);font-size:1rem;margin-top:4px}
.login-tabs{display:flex;gap:6px;margin-bottom:28px;
  background:var(--surface3);border-radius:999px;padding:4px}
.tab-btn{flex:1;padding:12px;border:none;background:transparent;color:var(--muted);border-radius:999px;
  cursor:pointer;font-weight:600;transition:all .2s;font-size:0.9rem;white-space:nowrap}
.tab-btn.active{background:var(--surface);color:var(--brand);box-shadow:0 2px 8px rgba(0,0,0,0.05)}

/* Moments Grid */
.moments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  background: var(--surface2);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}
.moment-cb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.moment-cb input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.login-panel{display:grid;gap:18px}
.login-hint{color:var(--muted);font-size:.82rem;margin-top:-8px}
.install-card{margin-top:22px;background:linear-gradient(135deg, rgba(0,196,140,.08), rgba(14,165,233,.08));
  border:1px solid rgba(0,196,140,.18);border-radius:24px;padding:20px;display:grid;gap:14px}
.install-card.compact{margin-top:22px}
.install-eyebrow{font-size:.72rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--brand);margin-bottom:6px}
.install-card h3{font-size:1.15rem;margin-bottom:4px}
.install-copy{color:var(--muted);font-size:.95rem}
.install-actions{display:flex;gap:12px;flex-wrap:wrap}
.install-note{color:var(--muted);font-size:.86rem;line-height:1.5}
.install-guide-block{background:var(--surface2);border:1px solid var(--border);border-radius:18px;padding:18px}
.install-steps{padding-left:20px;display:grid;gap:8px;color:var(--text)}

/* ── INPUTS & FIELDS ── */
.field-label{display:grid;gap:8px;font-size:.9rem;font-weight:600;color:var(--text)}
input,select,textarea{
  background:var(--surface);border:1.5px solid var(--border);border-radius:var(--radius-sm);
  padding:14px 16px;width:100%;transition:all .2s;color:var(--text);font-size:1rem}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 4px rgba(0,196,140,0.1)}
textarea{resize:vertical;min-height:80px}

/* ── BUTTONS ── */
.btn-primary{background:var(--brand);border:none;border-radius:999px;padding:14px 24px;font-weight:700;
  color:#fff;cursor:pointer;transition:transform .15s, background .2s, box-shadow .2s;white-space:nowrap;
  box-shadow:0 4px 14px rgba(0,196,140,0.3)}
.btn-primary:hover{background:var(--brand2);transform:translateY(-2px);box-shadow:0 6px 20px rgba(0,196,140,0.4)}
.btn-primary.full{width:100%}
.btn-accent{background:var(--surface);border:1.5px solid var(--border);border-radius:999px;padding:12px 22px;font-weight:700;
  color:var(--text);cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:8px;box-shadow:var(--shadow)}
.btn-accent:hover{border-color:var(--brand);color:var(--brand)}
.btn-ghost{background:transparent;border:1.5px solid var(--border);border-radius:999px;
  padding:12px 22px;font-weight:600;cursor:pointer;color:var(--muted);transition:all .2s}
.btn-ghost:hover{border-color:var(--muted);color:var(--text);background:var(--surface2)}
.btn-back{background:transparent;border:none;cursor:pointer;color:var(--muted);font-size:.95rem;
  padding:0;display:flex;align-items:center;gap:6px;font-weight:600;transition:color .2s}
.btn-back:hover{color:var(--brand)}
.btn-logout{background:var(--surface2);border:none;border-radius:var(--radius-sm);
  padding:12px;width:100%;cursor:pointer;color:var(--danger);font-weight:600;transition:background .2s}
.btn-logout:hover{background:rgba(239,68,68,.1)}
.btn-sm{padding:8px 16px;font-size:.85rem;border-radius:999px}
.btn-danger{background:rgba(239,68,68,.1);border:none;color:var(--danger);border-radius:999px;
  padding:8px 16px;cursor:pointer;font-weight:600;transition:background .2s}
.btn-danger:hover{background:rgba(239,68,68,.2)}

/* ══ APP SHELL ══ */
.app-shell{display:grid;grid-template-columns:260px 1fr;min-height:100vh}

/* ── SIDEBAR ── */
.sidebar{background:var(--surface);border-right:1px solid var(--border);
  display:flex;flex-direction:column;padding:32px 20px;gap:0;z-index:10}
.sidebar-top{flex:1;display:flex;flex-direction:column;gap:32px}
.brand{display:flex;align-items:center;gap:12px;padding:0 8px;margin-bottom:8px}
.brand-icon{font-size:2rem;background:rgba(0,196,140,.1);padding:8px;border-radius:12px}
.brand-name{font-size:1.2rem;font-weight:800;color:var(--text);margin:0}
.brand-role{font-size:.75rem;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.05em;margin-top:2px}
.sidebar-bottom{margin-top:auto;display:grid;gap:16px}
.sidebar-info{background:var(--bg);border-radius:var(--radius-sm);padding:16px;font-size:.85rem;color:var(--text);font-weight:600;text-align:center}

/* ── NAV ── */
.nav{display:grid;gap:8px}
.nav-btn{text-align:left;background:transparent;border:none;border-radius:var(--radius-sm);
  padding:14px 16px;cursor:pointer;color:var(--muted);font-weight:600;transition:all .2s;font-size:.95rem;display:flex;align-items:center;gap:10px}
.nav-btn:hover{background:var(--bg);color:var(--text)}
.nav-btn.active{background:var(--brand);color:#fff;box-shadow:0 4px 12px rgba(0,196,140,0.3)}
.tab-row{display:flex;gap:10px;flex-wrap:wrap}
.tab-row .tab-btn{flex:0 1 auto}

/* ══ MAIN ══ */
.main{padding:40px 48px;overflow-y:auto;background:var(--bg);min-width:0}
.view{display:none;flex-direction:column;gap:32px;animation:fadeUp .4s cubic-bezier(0.16, 1, 0.3, 1) both}
.view.active{display:flex}
@keyframes fadeUp{from{opacity:0;transform:translateY(15px)}to{opacity:1;transform:translateY(0)}}

/* ── PAGE HEADER ── */
.page-header{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;flex-wrap:wrap}
.page-header h1{font-size:2.2rem;color:var(--text)}
.page-header > div:last-child{display:flex;gap:12px;align-items:center;flex-wrap:wrap}

/* ── DATE STRIP (Mock) ── */
.date-strip{display:flex;gap:12px;overflow-x:auto;padding-bottom:10px;scrollbar-width:none}
.date-strip::-webkit-scrollbar{display:none}
.date-item{background:var(--surface);border:1.5px solid var(--border);border-radius:16px;padding:12px 16px;
  min-width:70px;text-align:center;cursor:pointer;transition:all .2s;color:var(--muted)}
.date-item .day{font-size:.75rem;font-weight:700;text-transform:uppercase;margin-bottom:4px}
.date-item .num{font-size:1.2rem;font-weight:800;color:var(--text)}
.date-item.active{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 4px 12px rgba(0,196,140,0.3)}
.date-item.active .num{color:#fff}

/* ── CARDS ── */
.card{background:var(--surface);border:1px solid rgba(0,0,0,0.03);border-radius:var(--radius);padding:28px;box-shadow:var(--shadow)}
.card-header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.card-header h2{font-size:1.25rem;font-weight:700}

/* ── STATS GRID ── */
.stats-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px}
.stat-card{background:var(--surface);border-radius:var(--radius);padding:24px;text-align:center;box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:center}
.stat-val{font-size:2.2rem;font-weight:800;color:var(--text);line-height:1}
.stat-label{font-size:.8rem;color:var(--muted);margin-top:8px;font-weight:600}

/* ── PILLS & BADGES ── */
.pill{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;
  font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em}
.pill-brand{background:rgba(0,196,140,.1);color:var(--brand)}
.pill-success{background:rgba(16,185,129,.1);color:var(--success)}
.pill-warning{background:rgba(245,158,11,.1);color:var(--warning)}
.pill-danger{background:rgba(239,68,68,.1);color:var(--danger)}

/* ── PATIENT GRID ── */
.patient-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:20px}
.patient-card{background:var(--surface);border-radius:var(--radius);padding:24px;cursor:pointer;
  transition:all .2s;box-shadow:var(--shadow);border:1.5px solid transparent}
.patient-card:hover{border-color:var(--brand);transform:translateY(-3px);box-shadow:var(--shadow-hover)}
.patient-card-header{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:16px}
.patient-avatar{width:48px;height:48px;border-radius:50%;background:rgba(0,196,140,.1);color:var(--brand);
  display:flex;align-items:center;justify-content:center;font-weight:800;font-size:1.2rem}
.patient-name{font-weight:800;font-size:1.1rem;color:var(--text)}
.patient-sub{font-size:.85rem;color:var(--muted);margin-top:2px;font-weight:500}
.patient-meta{display:grid;gap:6px;margin-top:16px;font-size:.85rem;color:var(--muted);padding-top:16px;border-top:1px solid var(--border)}
.patient-meta span{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
.patient-meta span strong{color:var(--text)}

/* ── DETAIL GRID ── */
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.detail-grid .card.full{grid-column:1/-1}

/* ── CHART ── */
.chart-wrap{position:relative;height:300px;width:100%}

/* ── FOOD TABLE ── */
.food-filters{display:flex;gap:16px;flex-wrap:wrap;margin-bottom:20px;align-items:center}
.food-filters input,.food-filters select{width:auto;flex:1;min-width:180px;background:var(--surface);border-radius:999px;padding:12px 20px}
.toggle-label{display:flex;align-items:center;gap:8px;font-size:.9rem;font-weight:600;cursor:pointer;color:var(--text)}
.toggle-label input{width:auto;cursor:pointer;accent-color:var(--brand)}
.table-wrap{overflow-x:auto;background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);-webkit-overflow-scrolling:touch}
.data-table{width:100%;border-collapse:collapse;font-size:.9rem}
.data-table th,.data-table td{word-break:break-word}
.data-table th{text-align:left;padding:16px 20px;color:var(--muted);font-weight:700;font-size:.8rem;
  text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);background:var(--surface2)}
.data-table td{padding:16px 20px;border-bottom:1px solid var(--border);vertical-align:middle;color:var(--text)}
.data-table tr:hover td{background:var(--surface2)}
.data-table tr.inactive td{opacity:.5;text-decoration:line-through}

/* ── CHAT ── */
.chat-layout{display:grid;grid-template-columns:280px 1fr;gap:0;
  background:var(--surface);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);
  height:calc(100vh - 220px)}
.chat-layout.single{grid-template-columns:1fr}
.chat-sidebar{border-right:1px solid var(--border);padding:20px;background:var(--surface2);overflow-y:auto}
.chat-sidebar-title{font-size:.8rem;font-weight:700;text-transform:uppercase;color:var(--muted);margin-bottom:16px}
.chat-patient-btn{width:100%;text-align:left;background:var(--surface);border:1px solid var(--border);border-radius:12px;
  padding:14px 16px;cursor:pointer;font-size:.95rem;color:var(--text);font-weight:600;transition:all .2s;margin-bottom:8px}
.chat-patient-btn:hover{border-color:var(--brand)}
.chat-patient-btn.active{background:var(--brand);color:#fff;border-color:var(--brand);box-shadow:0 4px 12px rgba(0,196,140,0.3)}
.chat-main{display:flex;flex-direction:column;overflow:hidden;background:var(--bg)}
.chat-header{padding:20px 24px;border-bottom:1px solid var(--border);background:var(--surface)}
.chat-messages{flex:1;overflow-y:auto;padding:24px;display:flex;flex-direction:column;gap:16px}
.chat-bubble{max-width:75%;padding:14px 18px;border-radius:20px;font-size:.95rem;line-height:1.5;box-shadow:0 2px 5px rgba(0,0,0,0.02)}
.bubble-admin{background:var(--brand);color:#fff;align-self:flex-end;border-bottom-right-radius:4px}
.bubble-user{background:var(--surface);color:var(--text);align-self:flex-start;border-bottom-left-radius:4px;border:1px solid var(--border)}
.bubble-meta{font-size:.75rem;opacity:.7;margin-top:6px;font-weight:500}
.chat-input{padding:20px 24px;border-top:1px solid var(--border);background:var(--surface);display:flex;gap:12px;align-items:flex-end}
.chat-input textarea{flex:1;min-height:50px;max-height:120px;border-radius:24px;padding:14px 20px;resize:none}
.chat-input button{border-radius:50%;width:50px;height:50px;padding:0;display:flex;align-items:center;justify-content:center}

/* ── MEAL PLAN (4eat Style) ── */
.meals-stack{display:grid;gap:24px}
.meal-card{background:var(--surface);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.meal-header{padding:20px 24px;background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.meal-title{font-weight:800;font-size:1.1rem;color:var(--text)}
.meal-time{font-size:.85rem;color:var(--muted);font-weight:600;background:var(--surface2);padding:6px 12px;border-radius:999px}
.meal-options{padding:24px;display:grid;gap:16px}
.option-row{display:flex;gap:16px;padding:16px;border-radius:var(--radius-sm);
  border:2px solid var(--border);background:var(--surface);cursor:pointer;transition:all .2s;position:relative}
.option-row:hover{border-color:var(--brand);box-shadow:0 4px 12px rgba(0,196,140,0.1)}
.option-row.chosen{border-color:var(--success);background:rgba(16,185,129,.03)}
.option-row.chosen-today{border-color:var(--brand);background:rgba(0,196,140,.05);box-shadow:0 4px 15px rgba(0,196,140,0.15)}

/* Image Placeholder for Meal Options */
.option-image{width:90px;height:90px;border-radius:12px;background:var(--surface2);flex-shrink:0;overflow:hidden;position:relative;display:flex;align-items:center;justify-content:center;font-size:2rem;color:var(--border)}
.option-image img{width:100%;height:100%;object-fit:cover}

.option-body{flex:1;display:flex;flex-direction:column;justify-content:center}
.option-label{font-weight:800;font-size:1.05rem;color:var(--text);margin-bottom:6px}
.option-desc{font-size:.9rem;color:var(--muted);line-height:1.5}
.option-macros{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.macro-chip{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:4px 10px;font-size:.75rem;font-weight:700;color:var(--text)}

.option-check{position:absolute;top:16px;right:16px;width:28px;height:28px;border-radius:50%;border:2px solid var(--border);
  display:flex;align-items:center;justify-content:center;background:var(--surface);transition:all .2s;z-index:2}
.option-row.chosen-today .option-check{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:bold}

.option-count{position:absolute;bottom:16px;right:16px;font-size:.75rem;font-weight:700;color:var(--brand);background:rgba(0,196,140,.1);padding:4px 10px;border-radius:999px}

/* ── WEIGHT GATE BANNER ── */
.weight-gate-banner{background:rgba(245,158,11,.1);border:1px solid rgba(245,158,11,.3);
  border-radius:var(--radius-sm);padding:16px 20px;display:flex;align-items:center;
  justify-content:space-between;gap:16px;width:100%;margin-top:16px}
.weight-gate-banner div{color:#d97706;font-size:.95rem}
.weight-gate-banner.danger{background:rgba(239,68,68,.1);border:1px solid rgba(239,68,68,.3)}
.weight-gate-banner.danger div{color:#ef4444}

/* ── FORM GRID ── */
.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}

/* ── MODAL ── */
.modal-overlay{position:fixed;inset:0;background:rgba(17,24,39,.7);backdrop-filter:blur(4px);
  z-index:200;display:flex;align-items:center;justify-content:center;padding:20px}
.modal-card{background:var(--surface);border-radius:28px;
  padding:32px;width:min(700px,95%);box-shadow:0 25px 50px -12px rgba(0,0,0,0.25);
  display:flex;flex-direction:column;gap:0;max-height:95vh;overflow:hidden}
.modal-card.wide { width: min(1000px, 95%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-card h2{font-size:1.5rem;margin:0}
.modal-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:24px;padding-top:20px;border-top:1px solid var(--border)}

/* Moment Tags in Table */
.moment-tag {
  display: inline-block;
  background: var(--surface3);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* ── RESPONSIVE ── */
@media(max-width:900px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{flex-direction:column;padding:16px 16px 12px;border-right:0;border-bottom:1px solid var(--border);align-items:stretch;gap:16px;position:sticky;top:0}
  .sidebar-bottom{display:none}
  .sidebar-top{flex-direction:column;align-items:stretch;gap:16px;width:100%;justify-content:flex-start}
  .brand{padding:0;margin-bottom:0}
  .nav{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;scrollbar-width:none}
  .nav::-webkit-scrollbar{display:none}
  .nav-btn{padding:12px 14px;font-size:.92rem;white-space:nowrap;flex:0 0 auto}
  .main{padding:24px}
  .detail-grid{grid-template-columns:1fr}
  .chat-layout{grid-template-columns:1fr;height:calc(100vh - 180px)}
  .chat-sidebar{display:flex;overflow-x:auto;border-right:0;border-bottom:1px solid var(--border);padding:12px}
  .chat-sidebar-title{display:none}
  .chat-patient-btn{width:auto;white-space:nowrap;margin-bottom:0;margin-right:8px}
  .chat-messages{min-height:300px}
}
/* ── PREMIUM MEAL PLAN GRID (REPLACES EXCEL STYLE) ── */
.excel-meal-block {
  margin-bottom: 40px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  animation: fadeUp 0.5s ease-out;
}
.excel-header-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface2);
}
.excel-header-table th {
  padding: 12px 16px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.moment-row td {
  padding: 16px;
  background: white;
  border-bottom: 2px solid var(--bg);
}
.moment-row strong { 
  font-size: 1.2rem; 
  color: var(--brand);
  font-weight: 800;
}
.kcal-val { background: rgba(16, 185, 129, 0.05); font-weight: 800; color: var(--success); text-align: center; font-size: 1.1rem; }
.p-val { background: rgba(14, 165, 233, 0.05); font-weight: 800; color: var(--accent); text-align: center; font-size: 1.1rem; }
.hc-val { background: rgba(245, 158, 11, 0.05); font-weight: 800; color: var(--warning); text-align: center; font-size: 1.1rem; }

.excel-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
  gap: 1px;
}
.plan-library-card,
.excel-meal-block{min-width:0}
.plan-library-header{gap:16px}
.plan-library-actions{flex-wrap:wrap;justify-content:flex-end}
.plan-summary-grid{align-items:start}
.plan-summary-block{min-width:0}
.plan-metrics-row{display:flex;gap:12px;flex-wrap:wrap}
.plan-metrics-row .field-label{min-width:0}
.excel-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.excel-option-card {
  background: white;
  transition: all 0.2s;
}
.excel-option-card:hover {
  background: var(--surface2);
}
.excel-option-card.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-style: italic;
  font-weight: 500;
  font-size: 0.9rem;
}
.excel-option-card.empty:hover {
  color: var(--brand);
  background: rgba(0, 196, 140, 0.05);
}

.option-inner-table {
  width: 100%;
  border-collapse: collapse;
}
.option-title-row th {
  text-align: left;
  padding: 10px 16px;
  background: #fdf2f2; /* Default Soft Red/Pink */
  color: #be123c;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.excel-col:nth-child(1) .option-title-row th { background: #ecfdf5; color: #047857; } /* Soft Green */
.excel-col:nth-child(2) .option-title-row th { background: #eff6ff; color: #1d4ed8; } /* Soft Blue */

.option-subheader-row th {
  padding: 4px 16px !important;
  font-size: 0.65rem !important;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.hc-total { text-align: center; font-weight: 800; opacity: 0.8; }

.status-green { color: var(--success) !important; font-weight: 900 !important; }
.status-red { color: var(--danger) !important; font-weight: 900 !important; }
.status-orange { color: var(--warning) !important; font-weight: 900 !important; }

.food-item-row { cursor: pointer; transition: all 0.2s; }
.food-item-row:hover { background: var(--surface3); }
.food-item-row td {
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}
.food-item-row.empty td { 
  color: var(--muted); 
  font-size: 0.75rem; 
  opacity: 0.6;
}
.qty-cell { 
  text-align: center; 
  color: var(--muted); 
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface2);
  width: 80px;
}
.val-cell { 
  text-align: center; 
  width: 50px; 
  font-weight: 600;
  font-size: 0.8rem;
}
.val-cell:nth-last-child(3) { color: var(--success); }
.val-cell:nth-last-child(2) { color: var(--accent); }
.val-cell:nth-last-child(1) { color: var(--warning); }

@media(max-width:1000px){
  .excel-options-grid { grid-template-columns: 1fr; }
}

/* Selector markers */
.diff-green { background-color: #f0fdf4 !important; }
.diff-red { background-color: #fef2f2 !important; }
.diff-green td:first-child { border-left: 4px solid var(--success); }
.diff-red td:first-child { border-left: 4px solid var(--danger); }


@media(max-width:900px){
  .excel-options-grid { grid-template-columns: 1fr; }
}

@media(max-width:600px){
  body{font-size:16px}
  .login-card{padding:28px 20px;border-radius:22px}
  .login-tabs{overflow-x:auto;padding:4px;scrollbar-width:none}
  .login-tabs::-webkit-scrollbar{display:none}
  .login-tabs .tab-btn{min-width:max-content;padding:11px 14px}
  .main{padding:16px}
  .view{gap:20px}
  .page-header{align-items:flex-start;gap:14px}
  .page-header h1{font-size:1.7rem;line-height:1.15}
  .page-header > div,
  .page-header > div:last-child{width:100%}
  .page-header > div:last-child > *{flex:1 1 auto}
  .card{padding:18px}
  .form-grid{grid-template-columns:1fr}
  .stats-row{grid-template-columns:1fr 1fr}
  .stat-card{padding:18px}
  .stat-val{font-size:1.7rem}
  .patient-grid{grid-template-columns:1fr}
  .patient-card{padding:18px}
  .patient-card-header{gap:12px}
  .patient-card-header > div:first-child{min-width:0}
  .patient-name,.patient-sub{overflow-wrap:anywhere}
  .patient-meta span{flex-direction:column;align-items:flex-start}
  .food-filters{gap:12px}
  .food-filters input,.food-filters select{min-width:100%}
  .option-row{flex-direction:column;align-items:flex-start}
  .option-image{width:100%;height:140px}
  .option-check{top:16px;right:16px}
  .option-count{bottom:16px;right:16px}
  .weight-gate-banner{flex-direction:column;align-items:flex-start}
  .chat-layout{min-height:unset}
  .chat-header,.chat-messages,.chat-input-area,.chat-sidebar-header{padding:16px}
  .chat-bubble{max-width:88%}
  .chat-controls{flex-direction:column;align-items:stretch}
  .chat-actions{justify-content:flex-end}
  .tips-grid{grid-template-columns:1fr}
  .tip-list-item{flex-direction:column;align-items:flex-start;padding:18px;gap:16px}
  .tip-thumb,.tip-thumb-placeholder{width:100%;height:160px}
  .modal-overlay{padding:10px}
  .modal-card,
  .modal-card.wide{width:100%;max-height:92vh;padding:20px;border-radius:22px}
  .modal-header{align-items:flex-start;gap:12px;margin-bottom:18px}
  .modal-header h2{font-size:1.25rem}
  .modal-actions{flex-direction:column-reverse}
  .modal-actions button{width:100%}
  .modal-scroll-area{padding:4px 12px;margin:0 -12px}
  .photo-section{width:100%;position:static}
  .photo-btns{flex-direction:column}
  .install-card{padding:18px;border-radius:20px}
  .install-actions{flex-direction:column}
  .install-actions button{width:100%}
  .nav{flex-wrap:wrap;overflow:visible}
  .nav-btn{flex:1 1 calc(50% - 8px);justify-content:center;text-align:center;padding:12px 10px}
  .tab-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .tab-row .tab-btn{width:100%;min-width:0;white-space:normal;line-height:1.2;border-radius:18px;padding:12px 10px}
  .plan-library-header{flex-direction:column;align-items:flex-start}
  .plan-library-actions{width:100%;justify-content:stretch}
  .plan-library-actions .btn-sm{flex:1 1 0}
  .plan-summary-grid{grid-template-columns:1fr !important;gap:20px !important}
  .plan-metrics-row{display:grid !important;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px !important}
  .plan-target-input,.meal-target-input,.summary-val{width:100%}
  .summary-val{text-align:center}
  .excel-header-table,
  .excel-header-table thead,
  .excel-header-table tbody,
  .excel-header-table tr{display:block}
  .excel-header-table thead{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0, 0, 0, 0);
    white-space:nowrap;
    border:0;
  }
  .moment-row{
    display:grid !important;
    grid-template-columns:1fr 1fr;
    gap:10px;
    padding:14px;
    background:white;
  }
  .moment-row td{
    display:flex;
    flex-direction:column;
    gap:6px;
    padding:0;
    border:0;
    min-width:0;
  }
  .moment-row td::before{
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.06em;
    text-transform:uppercase;
    color:var(--muted);
  }
  .moment-row td:nth-child(1){grid-column:1/-1}
  .moment-row td:nth-child(1)::before{content:"Momento"}
  .moment-row td:nth-child(2)::before{content:"Hora"}
  .moment-row td:nth-child(3)::before{content:"Peso aprox"}
  .moment-row td:nth-child(4)::before{content:"Kcal"}
  .moment-row td:nth-child(5)::before{content:"P"}
  .moment-row td:nth-child(6)::before{content:"HC"}
  .moment-row strong{font-size:1rem}
  .meal-time{align-self:flex-start}
  .kcal-val,.p-val,.hc-val{font-size:1rem}
}

@media(max-width:760px){
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr{display:block}
  .data-table thead{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0, 0, 0, 0);
    white-space:nowrap;
    border:0;
  }
  .data-table tbody{display:grid;gap:14px;padding:14px}
  .data-table tr{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:18px;
    padding:14px;
    box-shadow:var(--shadow);
  }
  .data-table td{
    display:grid;
    grid-template-columns:minmax(88px, 108px) 1fr;
    gap:12px;
    padding:10px 0;
    border-bottom:1px solid var(--border);
    align-items:start;
  }
  .data-table td:last-child{border-bottom:none}
  .data-table td::before{
    content:attr(data-label);
    font-size:.72rem;
    line-height:1.3;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--muted);
  }
  .data-table td[style*="display:flex"]{
    display:flex !important;
    flex-wrap:wrap;
    justify-content:flex-start;
  }
  .data-table td[style*="display:flex"]::before{
    width:100%;
    margin-bottom:8px;
  }
  .option-inner-table{display:table}
}

/* ── PHOTO UPLOADER ── */
.photo-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface2);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}
.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.patient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── CLIENT MODAL LAYOUT ── */
.modal-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px;
  margin: 0 -20px;
}

.client-modal-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.photo-section {
  flex-shrink: 0;
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
}

.photo-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.photo-btns button {
  width: 100%;
  font-size: 0.85rem;
  padding: 8px;
}

.fields-section {
  flex-grow: 1;
}

.client-form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

.form-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

@media(max-width: 800px) {
  .client-modal-layout { flex-direction: column; align-items: center; }
  .client-form-grid { grid-template-columns: 1fr; }
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    grid-column: span 12;
  }
}

/* ── NOTIFICATIONS & BADGES ── */
.badge {
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  margin-left: 8px;
}
.badge-inline {
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 999px;
}
.nav-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  vertical-align: middle;
}
.hidden { display: none !important; }

/* ── CHAT OVERHAUL ── */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  height: calc(100vh - 220px);
}
.chat-sidebar { border-right: 1px solid var(--border); background: var(--surface2); display: flex; flex-direction: column; }
.chat-sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.chat-sidebar-title { font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.chat-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  transition: 0.2s;
}
.chat-search input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(0,196,140,0.1); }
#chatPatientList { flex: 1; overflow-y: auto; }
.chat-patient-btn {
  width: 100%; padding: 16px 20px; border: 0; background: transparent;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: 0.2s; border-bottom: 1px solid var(--border);
}
.chat-patient-btn:hover { background: rgba(0,0,0,0.03); }
.chat-patient-btn.active { background: white; color: var(--brand); font-weight: 700; border-left: 4px solid var(--brand); }

.chat-main { display: flex; flex-direction: column; }
.chat-header { padding: 16px 24px; border-bottom: 1px solid var(--border); background: white; }
.chat-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; }

.chat-bubble { max-width: 75%; padding: 12px 16px; border-radius: 18px; font-size: 0.95rem; position: relative; }
.bubble-admin { background: var(--brand); color: white; border-bottom-right-radius: 4px; }
.bubble-user { background: white; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble-meta { font-size: 0.7rem; margin-top: 4px; opacity: 0.7; }

.chat-input-area { padding: 20px; background: white; border-top: 1px solid var(--border); }
.chat-controls { display: flex; gap: 12px; align-items: flex-end; }
.chat-controls textarea { flex: 1; border: 1.5px solid var(--border); border-radius: 16px; padding: 12px; resize: none; font-family: inherit; }
.chat-actions { display: flex; gap: 8px; }

.btn-circle {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; cursor: pointer; transition: 0.2s; border: 1.5px solid var(--border);
}
.btn-circle:hover { transform: scale(1.05); }

.recording-status { margin-top: 8px; font-size: 0.85rem; color: #ef4444; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.recording-active { background: #fee2e2 !important; border-color: #ef4444 !important; animation: pulse 1.5s infinite; }

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.audio-msg audio { height: 36px; border-radius: 18px; }

/* ── BUBBLE ACTIONS ── */
.bubble-actions {
  position: absolute;
  top: -10px;
  right: -10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: 0.2s;
  z-index: 10;
}
.chat-bubble:hover .bubble-actions { opacity: 1; }
.bubble-actions button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.bubble-actions button:hover { transform: scale(1.1); background: var(--surface2); }
.bubble-user .bubble-actions { right: auto; left: -10px; }

/* ── TIPS GRID ── */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 20px;
}
.tip-card {
  background: var(--surface);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.tip-card.inactive { opacity: 0.6; filter: grayscale(0.8); }
.tip-img { width: 100%; height: 220px; object-fit: cover; border-bottom: 1px solid var(--border); }
.tip-img-placeholder { height: 220px; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 3.5rem; border-bottom: 1px solid var(--border); }
.tip-content { padding: 24px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.tip-content h3 { font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.tip-content p { font-size: 0.95rem; color: var(--muted); line-height: 1.6; }
.tip-actions { margin-top: auto; display: flex; gap: 10px; justify-content: flex-end; padding-top: 16px; border-top: 1px dashed var(--border); }
.card-hover:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--brand); }

/* ── TIPS COMPACT GRID ── */
.tips-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.tip-card-compact {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  min-height: 120px;
}
.tip-card-compact.inactive { opacity: 0.6; filter: grayscale(0.8); }
.tip-thumb-area {
  width: 120px;
  min-width: 120px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.tip-thumb-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.tip-card-compact:hover { border-color: var(--brand); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.tip-card-compact:hover .tip-thumb-img { transform: scale(1.1); }
.tip-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.tip-body h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.tip-body p { font-size: 0.95rem; color: var(--muted); line-height: 1.5; }
.tip-card-compact .tip-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media(max-width: 600px) {
  .tips-grid-compact { grid-template-columns: 1fr; }
  .tip-card-compact { flex-direction: column; }
  .tip-thumb-area { width: 100%; height: 150px; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ── TIPS LIST (USER) ── */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.tip-list-item {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  padding: 20px;
  gap: 24px;
  align-items: center;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}
.tip-thumb {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: zoom-in;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.tip-thumb img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.tip-thumb:hover img { transform: scale(1.1); }
.tip-thumb-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  color: var(--brand);
}
.tip-list-item h3 { font-size: 1.2rem; margin-bottom: 6px; color: var(--text); font-weight: 700; }
.tip-list-item p { font-size: 1rem; color: var(--muted); line-height: 1.6; }
.tip-list-item:hover { border-color: var(--brand); background: var(--surface2); transform: translateX(4px); }

/* ── TARGET INPUTS (ADMIN) ── */
.plan-target-input, .meal-target-input {
  width: 70px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  background: var(--surface2);
}
.plan-target-input:focus, .meal-target-input:focus {
  border-color: var(--brand);
  background: white;
  outline: none;
}
.summary-val {
  font-size: 1.1rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface2);
}
.meal-target-input {
  width: 60px;
  background: transparent;
  border-color: transparent;
}
.meal-target-input:hover {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}

@media(max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; min-height: 500px; }
  .chat-sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-patient-btn { width: auto; white-space: nowrap; border-bottom: 0; border-right: 1px solid var(--border); }
}

/* Mobile App Navigation */
.sidebar-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.mobile-nav-toggle,
.mobile-nav-overlay{display:none}
.mobile-nav-toggle{
  border:1px solid var(--border);
  background:var(--surface);
  border-radius:16px;
  width:48px;
  height:48px;
  padding:0;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:5px;
  box-shadow:var(--shadow);
  position:fixed;
  top:16px;
  left:16px;
  z-index:31;
  transition:left .24s ease, transform .2s ease, box-shadow .2s ease;
}
.mobile-nav-toggle span{
  width:20px;
  height:2px;
  background:var(--text);
  border-radius:999px;
  transition:transform .2s ease, opacity .2s ease;
}
.mobile-nav-toggle.active span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.mobile-nav-toggle.active span:nth-child(2){opacity:0}
.mobile-nav-toggle.active span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
.btn-send{
  background:var(--brand);
  border-color:var(--brand);
  color:#fff;
  box-shadow:0 8px 20px rgba(0,196,140,.25);
  font-size:1rem;
}
.btn-send:hover{background:var(--brand2);border-color:var(--brand2)}
.chat-actions .btn-send{font-weight:900}
.audio-msg audio{width:100%;max-width:260px}

@media(max-width:900px){
  .mobile-nav-toggle{display:flex}
  .mobile-nav-overlay{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(17,24,39,.38);
    border:0;
    z-index:29;
  }
  body.mobile-nav-open{overflow:hidden}
  .sidebar{
    position:fixed;
    inset:0 auto 0 0;
    width:min(82vw,320px);
    max-width:320px;
    height:100dvh;
    border-right:1px solid var(--border);
    border-bottom:0;
    transform:translateX(-100%);
    transition:transform .24s ease;
    overflow-y:auto;
    box-shadow:0 30px 60px rgba(15,23,42,.18);
    z-index:30;
    padding:18px 16px 22px;
    background:var(--surface);
  }
  .sidebar.mobile-open{transform:translateX(0)}
  .mobile-nav-toggle.active{left:min(calc(82vw - 64px), 256px)}
  .sidebar-top{gap:18px}
  .sidebar-bottom{display:grid}
  .nav{
    display:grid;
    grid-template-columns:1fr;
    overflow:visible;
    padding:0;
  }
  .nav-btn{
    width:100%;
    justify-content:flex-start;
    text-align:left;
    white-space:normal;
    flex:auto;
  }
  .main{
    padding:18px 14px 22px;
    width:100%;
  }
}

@media(max-width:600px){
  .mobile-nav-toggle{
    top:14px;
    left:14px;
    width:44px;
    height:44px;
    border-radius:14px;
  }
  .mobile-nav-toggle.active{left:min(calc(82vw - 58px), 246px)}
  .sidebar-header .brand{flex:1;min-width:0}
  .brand-name{font-size:1.05rem}
  .brand-role{font-size:.7rem}
  .page-header{
    position:sticky;
    top:0;
    z-index:8;
    background:linear-gradient(180deg, rgba(244,247,246,.98), rgba(244,247,246,.93));
    padding:10px 0 12px 58px;
    margin:0;
    min-height:58px;
    backdrop-filter:blur(8px);
  }
  .page-header h1{font-size:1.65rem}
  .page-header .btn-primary,
  .page-header .btn-ghost,
  .page-header .btn-accent{min-height:46px}
  .login-tabs:not(.food-tabs){overflow-x:auto}

  .food-filters{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:12px;
    align-items:center;
  }
  .food-filters input{
    grid-column:1/-1;
    min-width:0;
  }
  .food-filters select{
    min-width:0;
    width:100%;
  }
  .toggle-label{
    min-height:48px;
    padding:0 6px;
    gap:10px;
    justify-self:start;
  }
  .toggle-label input{
    flex:0 0 auto;
  }
  .table-wrap{
    background:transparent;
    box-shadow:none;
    border-radius:0;
  }

  .food-data-table tbody{
    display:grid;
    gap:10px;
    padding:8px 0 0;
  }
  .food-data-table tr{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px 12px;
    padding:12px;
    border:1px solid var(--border);
    border-radius:16px;
    box-shadow:var(--shadow);
    background:var(--surface);
  }
  .food-data-table td{
    display:flex;
    flex-direction:column;
    gap:4px;
    padding:0 0 8px;
    border-bottom:1px solid var(--border);
    min-width:0;
  }
  .food-data-table td::before{
    content:attr(data-label);
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.05em;
    text-transform:uppercase;
    color:var(--muted);
  }
  .food-data-table td:first-child,
  .food-data-table td:last-child{
    grid-column:1/-1;
  }
  .food-data-table td:nth-child(3){
    align-content:flex-start;
  }
  .food-data-table td:last-child{
    border-bottom:0;
    padding-bottom:0;
  }
  .food-data-table td:last-child[style*="display:flex"]{
    display:flex !important;
    flex-direction:row;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
  }
  .food-data-table td:last-child[style*="display:flex"]::before{
    width:100%;
    margin-bottom:2px;
  }
  .food-data-table td strong{
    line-height:1.3;
  }
  .food-data-table .moment-tag{
    margin:0 4px 4px 0;
    padding:3px 7px;
    border-radius:8px;
    font-size:.74rem;
    line-height:1.15;
  }
  .food-data-table .pill{
    width:max-content;
    max-width:100%;
  }
  .food-data-table .btn-sm{
    padding:8px 12px;
    font-size:.82rem;
  }

  .plan-library-card{padding:16px}
  .plan-library-card h2{font-size:1.05rem}
  .tab-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
  .tab-row .tab-btn{
    min-width:0;
    width:100%;
    white-space:normal;
    padding:10px 8px;
    font-size:.82rem;
  }
  .plan-summary-grid{gap:16px !important}
  .plan-metrics-row{
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px !important;
  }
  .plan-metrics-row .field-label{
    font-size:.8rem;
    gap:6px !important;
  }
  .summary-val{padding:8px 6px;font-size:1rem}
  .excel-meal-block{margin-bottom:18px}
  .moment-row{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    grid-template-areas:
      "moment moment"
      "time portion"
      "kcal p"
      "hc hc";
    gap:12px;
    padding:14px;
  }
  .moment-row td{
    border:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  .moment-row td:nth-child(1){grid-area:moment}
  .moment-row td:nth-child(2){grid-area:time}
  .moment-row td:nth-child(3){grid-area:portion}
  .moment-row td:nth-child(4){grid-area:kcal}
  .moment-row td:nth-child(5){grid-area:p}
  .moment-row td:nth-child(6){grid-area:hc}
  .moment-row strong{font-size:1.15rem;line-height:1.1}
  .moment-row td::before{
    font-size:.7rem;
    font-weight:800;
    letter-spacing:.06em;
    text-transform:uppercase;
    color:var(--muted);
  }
  .moment-row td:nth-child(1)::before{content:"Momento"}
  .moment-row td:nth-child(2)::before{content:"Hora"}
  .moment-row td:nth-child(3)::before{content:"Peso aprox"}
  .moment-row td:nth-child(4)::before{content:"Kcal"}
  .moment-row td:nth-child(5)::before{content:"P"}
  .moment-row td:nth-child(6)::before{content:"HC"}
  .meal-target-input{
    width:100%;
    min-height:38px;
    border:1px solid var(--border);
    background:var(--surface2);
    border-radius:10px;
  }

  .tips-grid-compact{
    display:grid;
    grid-template-columns:1fr;
    gap:12px;
    margin-top:14px;
  }
  .tip-card-compact{
    min-height:unset;
    border-radius:16px;
    display:grid;
    grid-template-columns:72px 1fr;
    align-items:stretch;
  }
  .tip-thumb-area{
    width:72px;
    min-width:72px;
    border-right:1px solid var(--border);
    border-bottom:0;
    height:auto;
  }
  .tip-thumb-img,
  .tip-thumb-placeholder{
    width:100%;
    height:100%;
    min-height:72px;
    font-size:1.6rem;
  }
  .tip-body{
    padding:12px 12px 10px;
    gap:6px;
  }
  .tip-body h3{font-size:1rem;line-height:1.2}
  .tip-body p{
    font-size:.88rem;
    line-height:1.4;
    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }
  .tip-card-compact .tip-actions{
    padding-top:8px;
    margin-top:4px;
  }
  .tip-card-compact .btn-sm{
    padding:7px 12px;
    font-size:.8rem;
  }

  .chat-layout,
  #userChatContainer{
    min-height:calc(100dvh - 180px);
    height:auto;
    border-radius:18px;
  }
  .chat-sidebar-header{
    padding:12px 14px;
  }
  .chat-patient-btn{
    padding:11px 12px;
    font-size:.88rem;
    border-radius:12px;
  }
  .chat-header{
    padding:12px 14px;
  }
  .chat-messages{
    padding:14px 12px;
    gap:10px;
  }
  .chat-bubble{
    max-width:90%;
    padding:10px 12px;
    font-size:.92rem;
    border-radius:16px;
  }
  .bubble-meta{font-size:.68rem}
  .chat-input-area{
    padding:12px;
    position:sticky;
    bottom:0;
    z-index:4;
    background:rgba(255,255,255,.98);
    backdrop-filter:blur(8px);
  }
  .chat-controls{
    flex-direction:row;
    align-items:flex-end;
    gap:10px;
  }
  .chat-controls textarea{
    min-height:52px;
    border-radius:18px;
    padding:14px 16px;
  }
  .chat-actions{
    flex-direction:column;
    gap:8px;
  }
  .btn-circle{
    width:42px;
    height:42px;
    font-size:1rem;
    flex-shrink:0;
  }
  .audio-msg audio{
    width:100%;
    max-width:100%;
    height:34px;
  }

  .modal-card.wide{
    padding:16px;
  }
  .client-modal-layout{
    gap:18px;
    align-items:stretch;
  }
  .photo-section{
    width:100%;
    align-items:center;
    gap:12px;
  }
  .photo-preview{
    width:88px;
    height:88px;
  }
  .photo-btns{
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
  .photo-btns button{
    width:100%;
  }
  .modal-actions{
    position:sticky;
    bottom:0;
    background:var(--surface);
    padding-top:14px;
  }
}

/* ── TABLAS DE PLAN (móvil/tablet): evitar que se corte la columna HC ── */
@media(max-width:900px){
  .excel-meal-block{overflow:hidden}
  .excel-header-table{table-layout:fixed;width:100%}
  .excel-header-table th{padding:10px 6px;font-size:.62rem;letter-spacing:.04em;word-break:break-word}
  .option-inner-table{table-layout:fixed;width:100%}
  .option-title-row th{padding:8px 6px;font-size:.66rem;letter-spacing:.02em}
  .option-subheader-row th{padding:4px 4px !important;font-size:.56rem !important}
  .food-item-row td{padding:9px 6px;font-size:.78rem}
  .option-inner-table .name-cell{word-break:break-word}
  .option-inner-table .qty-cell{width:54px;font-size:.64rem;padding:9px 4px;word-break:break-word}
  .option-inner-table .val-cell{width:36px;font-size:.72rem;padding:9px 2px}
  .kcal-total,.p-total,.hc-total{font-size:.8rem}
}

/* ════════ SUSCRIPCIÓN / PAGOS ════════ */
.sub-status{display:flex;align-items:center;justify-content:space-between;gap:20px;flex-wrap:wrap;
  background:linear-gradient(135deg, rgba(0,196,140,.10), rgba(14,165,233,.08));
  border:1px solid rgba(0,196,140,.2);border-radius:var(--radius);padding:24px;margin-bottom:24px}
.sub-status.expired{background:rgba(245,158,11,.08);border-color:rgba(245,158,11,.3)}
.sub-status.none{background:var(--surface);border:1px solid var(--border)}
.sub-status h2{font-size:1.3rem;margin-bottom:6px}
.sub-status .muted{font-size:.92rem}
.sub-status-ring{width:96px;height:96px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;
  justify-content:center;flex-direction:column;background:var(--surface);box-shadow:var(--shadow);border:3px solid var(--brand)}
.sub-status-ring.expired{border-color:var(--warning)}
.sub-status-ring .num{font-size:1.7rem;font-weight:800;line-height:1;color:var(--text)}
.sub-status-ring .lbl{font-size:.62rem;font-weight:700;text-transform:uppercase;color:var(--muted);margin-top:2px}

.sub-plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:20px}
.plan-price-card{position:relative;background:var(--surface);border:2px solid var(--border);border-radius:var(--radius);
  padding:26px 22px;display:flex;flex-direction:column;gap:10px;transition:all .2s;box-shadow:var(--shadow)}
.plan-price-card:hover{border-color:var(--brand);transform:translateY(-4px);box-shadow:var(--shadow-hover)}
.plan-price-card.featured{border-color:var(--brand)}
.plan-price-card .plan-badge{position:absolute;top:-12px;left:50%;transform:translateX(-50%);
  background:var(--brand);color:#fff;font-size:.7rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;
  padding:5px 14px;border-radius:999px;white-space:nowrap;box-shadow:0 4px 12px rgba(0,196,140,.35)}
.plan-price-card .offer-badge{position:absolute;top:14px;right:14px;background:rgba(239,68,68,.12);color:var(--danger);
  font-size:.7rem;font-weight:800;padding:4px 10px;border-radius:999px}
.plan-name{font-size:1.15rem;font-weight:800;color:var(--text)}
.plan-price{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.plan-price .now{font-size:2.1rem;font-weight:900;color:var(--brand);line-height:1}
.plan-price .was{font-size:1rem;color:var(--muted);text-decoration:line-through}
.plan-price .per{font-size:.85rem;color:var(--muted);font-weight:600}
.plan-permonth{font-size:.82rem;color:var(--muted)}
.plan-price-card .btn-primary{margin-top:8px;width:100%}

/* Checkout */
.checkout-line{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px dashed var(--border);font-size:.95rem}
.checkout-line.total{border-bottom:0;border-top:2px solid var(--border);margin-top:6px;padding-top:14px;font-size:1.2rem;font-weight:800}
.checkout-line .disc{color:var(--success);font-weight:700}
.demo-pay-note{margin-top:18px;background:rgba(14,165,233,.07);border:1px solid rgba(14,165,233,.2);
  border-radius:14px;padding:14px 16px;font-size:.88rem;color:var(--text);line-height:1.5}

/* Admin billing */
.billing-section{margin-bottom:24px}
.billing-section .card-header h2{font-size:1.2rem}
.price-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:16px}
.price-edit{background:var(--surface2);border:1px solid var(--border);border-radius:16px;padding:16px}
.price-edit label{font-size:.8rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.price-edit .price-input-wrap{display:flex;align-items:center;gap:6px;margin-top:8px}
.price-edit input{font-size:1.4rem;font-weight:800;padding:8px 10px;text-align:center}
.price-edit .eur{font-size:1.3rem;font-weight:800;color:var(--muted)}
.coupon-code-chip{font-family:monospace;font-weight:800;letter-spacing:.05em;background:var(--surface3);
  border:1px dashed var(--border);border-radius:8px;padding:4px 10px;display:inline-block;color:var(--text)}
.billing-list-item{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
  padding:14px 16px;border:1px solid var(--border);border-radius:14px;background:var(--surface);margin-bottom:10px}
.billing-list-item .bli-main{min-width:0;flex:1}
.billing-list-item .bli-title{font-weight:700;color:var(--text)}
.billing-list-item .bli-sub{font-size:.85rem;color:var(--muted);margin-top:2px}
.billing-list-item .bli-actions{display:flex;gap:8px;flex-wrap:wrap}
.billing-list-item.off{opacity:.55}

@media(max-width:600px){
  .sub-status{padding:18px;gap:14px}
  .sub-plans{grid-template-columns:1fr}
  .billing-list-item{align-items:flex-start;flex-direction:column}
  .billing-list-item .bli-actions{width:100%}
  .billing-list-item .bli-actions .btn-sm{flex:1 1 auto}
}
