/* NutriPetra - Design System 2026 */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300&display=swap');

/* === CSS Variables === */
:root {
  /* Brand Colors */
  --primary:        #5F8A4E;
  --primary-light:  #7DAB6A;
  --primary-dark:   #3D6330;
  --primary-bg:     #EEF5EA;
  --accent:         #C4906A;
  --accent-light:   #E8C4A8;
  --accent-bg:      #FDF4EC;
  --rose:           #C4878A;
  --rose-bg:        #FAF0F0;

  /* Neutrals */
  --bg:             #FAF8F4;
  --surface:        #FFFFFF;
  --surface2:       #F5F2ED;
  --border:         #E5DED5;
  --border-light:   #EDE8E2;
  --text:           #2A2520;
  --text-muted:     #7A736A;
  --text-light:     #A89E94;

  /* Semantic */
  --success:        #5A8A4E;
  --success-bg:     #EEF5EA;
  --warning:        #C49A3A;
  --warning-bg:     #FDF6E8;
  --danger:         #C45A5A;
  --danger-bg:      #FAEAEA;
  --info:           #4A7FA0;
  --info-bg:        #EAF4FA;

  /* Typography */
  --font-display:   'Cormorant Garamond', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      20px;
  --radius-xl:      28px;
  --shadow-sm:      0 1px 4px rgba(42,37,32,.06), 0 2px 8px rgba(42,37,32,.04);
  --shadow:         0 2px 12px rgba(42,37,32,.08), 0 4px 24px rgba(42,37,32,.05);
  --shadow-lg:      0 8px 32px rgba(42,37,32,.12), 0 2px 8px rgba(42,37,32,.06);
  --shadow-hover:   0 12px 40px rgba(42,37,32,.15), 0 4px 12px rgba(42,37,32,.08);

  /* Sidebar */
  --sidebar-w:      256px;
  --topbar-h:       64px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
}
::placeholder { color: var(--text-light); }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* === Layout === */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s ease;
}
.page-content {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
}
@media (max-width: 1024px) {
  .app-main { margin-left: 0; }
  .page-content { padding: 20px 16px; }
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform .3s ease;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-logo img { height: 38px; }
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: .02em;
}
.sidebar-logo-sub {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-light);
  padding: 16px 8px 8px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 400;
  transition: all .15s ease;
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 500;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 100px;
}
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-light);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--primary);
  font-weight: 500;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
}
.sidebar-user-role {
  font-size: .72rem;
  color: var(--text-muted);
}
.sidebar-logout {
  margin-top: 8px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .85rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: all .15s;
}
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* Sidebar mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: flex; align-items: center; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 99;
  }
  .sidebar-overlay.open { display: block; }
}

/* === Topbar === */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text);
  flex: 1;
}
.topbar-date {
  font-size: .82rem;
  color: var(--text-muted);
}
@media (max-width: 1024px) {
  .topbar { padding: 0 16px 0 60px; }
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow); }
.card-sm { padding: 16px; border-radius: var(--radius); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}
.card-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}
.stat-icon-green { background: var(--primary-bg); color: var(--primary); }
.stat-icon-orange { background: var(--accent-bg); color: var(--accent); }
.stat-icon-rose { background: var(--rose-bg); color: var(--rose); }
.stat-icon-blue { background: var(--info-bg); color: var(--info); }
.stat-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text);
}
.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === Dashboard Grid === */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.dashboard-welcome {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  color: white;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.dashboard-welcome::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.dashboard-welcome::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.welcome-date {
  font-size: .8rem;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.welcome-message {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 300;
  font-style: italic;
  margin-top: 8px;
  line-height: 1.3;
  max-width: 500px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-body);
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #a33; color: white; }
.btn-ghost {
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* === Forms === */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(95,138,78,.12);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237A736A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }
.form-section {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.form-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* Checkbox / Radio styled */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .82rem;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.checkbox-chip input { display: none; }
.checkbox-chip:hover { border-color: var(--primary); color: var(--primary); }
.checkbox-chip.checked, .checkbox-chip:has(input:checked) {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 500;
}

/* Calc display */
.calc-box {
  background: var(--primary-bg);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.calc-item-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.calc-item-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 400; color: var(--primary-dark); }
.calc-item-unit { font-size: .75rem; color: var(--text-muted); }

/* === Tables === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--surface2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  font-weight: 500;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: .9rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.td-actions { display: flex; gap: 6px; }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-gray { background: var(--surface2); color: var(--text-muted); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-orange { background: var(--accent-bg); color: var(--accent); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-purple { background: #F0EAF8; color: #7A52AA; }
.badge-teal { background: #EAF6F4; color: #3A8A7E; }
.badge-red { background: var(--danger-bg); color: var(--danger); }

/* === Alerts === */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #B8D4B0; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #DBAAA0; }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid #A0C4D8; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #D4BF80; }

/* === Page header === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}
.page-title small {
  display: block;
  font-size: .9rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
  margin-top: 4px;
}
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

/* === Client cards === */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all .2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.client-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.client-card.archived { opacity: .55; }
.client-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.client-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-bg), var(--accent-bg));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 500;
  flex-shrink: 0;
}
.client-name {
  font-weight: 500;
  font-size: .95rem;
  color: var(--text);
}
.client-meta {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.client-card-body { font-size: .82rem; color: var(--text-muted); line-height: 1.8; }
.client-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* === Meal Plan Builder === */
.meal-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.day-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.day-header {
  background: var(--surface2);
  padding: 14px 20px;
  font-weight: 500;
  font-size: .95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.day-header:hover { background: var(--primary-bg); }
.day-body { padding: 16px 20px; display: grid; gap: 12px; }
.meal-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: border-color .15s;
}
.meal-slot:hover { border-color: var(--primary-light); }
.meal-slot.has-recipe {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface);
}
.meal-slot-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.meal-slot-name { font-size: .9rem; font-weight: 500; color: var(--text); }
.meal-slot-macros { font-size: .75rem; color: var(--text-muted); display: flex; gap: 10px; margin-top: 4px; }
.meal-slot-macros span { display: flex; align-items: center; gap: 3px; }

/* Weekly summary */
.weekly-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}
.weekly-bar {
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 6px;
}
.weekly-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--primary);
  transition: width .3s ease;
}
.weekly-warning {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .8rem;
  color: var(--warning);
  margin-top: 8px;
}

/* === Recipe Modal === */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42,37,32,.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
}
.modal-close {
  background: var(--surface2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-search { padding: 16px 28px; }
.modal-body { padding: 0 28px 24px; overflow-y: auto; flex: 1; }
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.recipe-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
}
.recipe-card:hover { border-color: var(--primary); background: var(--primary-bg); }
.recipe-card-name { font-size: .9rem; font-weight: 500; margin-bottom: 6px; }
.recipe-card-macros {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: .72rem; color: var(--text-muted);
}

/* === Client Portal === */
.portal-body {
  background: var(--bg);
  min-height: 100vh;
  font-family: var(--font-body);
}
.portal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-content { max-width: 860px; margin: 0 auto; padding: 40px 24px; }
.portal-hero {
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--accent-bg) 100%);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
}
.portal-greeting {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 300;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.portal-subtitle { color: var(--text-muted); font-size: .95rem; line-height: 1.6; max-width: 540px; }
.portal-progress {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.progress-step.done {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
  font-weight: 500;
}
.progress-step.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 500;
}
.day-plan-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.day-plan-header {
  background: var(--surface2);
  padding: 14px 20px;
  font-weight: 500;
  font-size: .95rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.day-plan-body { padding: 16px 20px; }
.meal-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.meal-item:last-child { border-bottom: none; }
.meal-type {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.meal-title { font-weight: 500; color: var(--text); margin-bottom: 4px; }
.meal-desc { font-size: .85rem; color: var(--text-muted); }
.meal-macros-row {
  display: flex; gap: 12px;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Rating stars */
.star-rating {
  display: flex; gap: 4px;
}
.star {
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--border);
  transition: color .1s;
}
.star.active, .star:hover { color: var(--accent); }

/* === Intake Form === */
.intake-body {
  background: var(--bg);
  min-height: 100vh;
}
.intake-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.intake-hero {
  text-align: center;
  margin-bottom: 40px;
}
.intake-hero-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 300;
  color: var(--primary-dark);
  line-height: 1.2;
}
.intake-hero-sub {
  font-size: .95rem;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.7;
}
.intake-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 20px;
}
.intake-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 600;
  margin-right: 8px;
}
.intake-step-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}
.diagnosis-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.diagnosis-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.diagnosis-header:hover { background: var(--surface2); }
.diagnosis-header.active { background: var(--primary-bg); }
.diagnosis-details { padding: 16px; border-top: 1px solid var(--border-light); background: var(--surface2); display: none; }
.diagnosis-details.open { display: block; }

/* Sticky save bar */
.sticky-save {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 80;
  box-shadow: 0 -4px 20px rgba(42,37,32,.08);
}
.sticky-save-info { font-size: .82rem; color: var(--text-muted); }

/* === Biomarker display === */
.biomarker-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 500;
}
.bm-low { background: var(--info-bg); color: var(--info); }
.bm-ok { background: var(--success-bg); color: var(--success); }
.bm-high { background: var(--danger-bg); color: var(--danger); }
.bm-optimal { background: var(--primary-bg); color: var(--primary-dark); }

/* === Workflow checklist === */
.workflow-list { display: flex; flex-direction: column; gap: 8px; }
.workflow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
}
.workflow-item.done { background: var(--success-bg); color: var(--success); }
.workflow-item.pending { background: var(--surface2); color: var(--text-muted); }
.workflow-item.active { background: var(--accent-bg); color: var(--accent); }
.workflow-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .7rem;
}
.workflow-item.done .workflow-check { background: var(--success); color: white; border-color: var(--success); }

/* === Supplements === */
.supplement-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.supplement-name { font-weight: 500; flex: 1; }
.supplement-dose { font-size: .82rem; color: var(--text-muted); }

/* === Misc === */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.text-display {
  font-family: var(--font-display);
  font-style: italic;
}
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.gap-2 { display: flex; gap: 8px; }
.gap-3 { display: flex; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.hidden { display: none; }
.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: .4; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 70vh;
  height: 70vh;
  background: radial-gradient(circle, rgba(95,138,78,.12), transparent 70%);
  border-radius: 50%;
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 50vh;
  height: 50vh;
  background: radial-gradient(circle, rgba(196,144,106,.1), transparent 70%);
  border-radius: 50%;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  color: var(--primary);
  letter-spacing: .02em;
}
.login-tagline {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 24px;
}

/* Tabbed interface */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px;
  font-size: .88rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-search {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.filter-search input {
  width: 100%;
  padding-left: 36px;
}
.filter-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Scroll to top fab */
.fab-save {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
}
@media (max-width: 768px) {
  .login-card { padding: 28px 20px; }
  .dashboard-welcome { padding: 20px 24px; }
  .welcome-message { font-size: 1.3rem; }
  .page-title { font-size: 1.5rem; }
  .modal { max-height: 100vh; border-radius: 0; }
  .clients-grid { grid-template-columns: 1fr; }
  .portal-hero { padding: 24px 20px; }
  .portal-greeting { font-size: 1.7rem; }
  .sticky-save { padding: 12px 16px; }
}

/* Print */
@media print {
  .sidebar, .topbar, .sticky-save, .fab-save { display: none; }
  .app-main { margin-left: 0; }
  .page-content { padding: 0; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease forwards; }

/* Confirm modal */
.confirm-modal {
  position: fixed; inset: 0;
  background: rgba(42,37,32,.55);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.confirm-icon { font-size: 2.5rem; margin-bottom: 12px; }
.confirm-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; margin-bottom: 8px; }
.confirm-text { color: var(--text-muted); font-size: .9rem; line-height: 1.6; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; }
